Welcome Guest, Not a member yet? Register   Sign In
problem with odbc database driver
#1

[eluser]Nir Gavish[/eluser]
i've run into a curious problem with the odbc driver.
i'm connecting from a linux machine to an MSSQL 2008 machine with odbc.

while i get that the 'num_rows' function always returns -1, and that is fully a database/driver issue - for some reason when i try to create a ->result(), the whole application crashes (error 500, sometimes just a blank page), if i'm lucky, i get an error message informing me that the application died because it tried to allocated 2 terrabytes of memory(!).

This happens irregularly, ie: every few refreshes. sometimes it runs fine, sometimes the page returns error 500 and sometimes it gives the memory allocation error - in any case it's not really something that can be reproduced with percision, and the queries are SUPER simple.

what gives?
#2

[eluser]mighty3[/eluser]
Well I am also facing same kind of problem.
I've done various things, searched a lot at google but didn't find the way to resolve this issue.
Any help please.
__________________
online job in Pakistan
#3

[eluser]Nir Gavish[/eluser]
what driver are you using? i'm with FreeTDS, which is slowly revealing itself to be quite problematic, but i have no choice in the matter.

also, are you using activerecord or directly $this->db->query() the database?
#4

[eluser]mighty3[/eluser]
[quote author="Nir Gavish" date="1272332753"]what driver are you using? i'm with FreeTDS, which is slowly revealing itself to be quite problematic, but i have no choice in the matter.

also, are you using activerecord or directly $this->db->query() the database?[/quote]

I am using odbc driver and activerecord.
#5

[eluser]Nir Gavish[/eluser]
i'm told using activerecord with odbc is i recipe for trouble, try simple queries. in my case, however, i AM using simple queries, and nothing works, anyone has any idea?
#6

[eluser]auximage[/eluser]
I've just recently moved over into CI and am starting to port old code into the framework. I ran into this problem as well and was able to solve it (in my own code) using the below method. Obviously this needs to be worked into the CI framework somehow, and I'm at a loss currently in how to do that being new and all.

Code:
/*
     *Because I had to create my own row count function because ODBC $#%#$@$%$ kthnxbai
     *@returns $int Row count for the passed query
     */
    function __my_odbc_num_rows($con, $sql) {
        $result = odbc_exec($con,$sql);
        $count=0;
        while($temp = odbc_fetch_into($result, $counter)){
            $count++;
        }
        return $count;
    }

Of course this will have to be adapted to work w/ CI. But that's the basis there..




Theme © iAndrew 2016 - Forum software by © MyBB