Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in
Ran September <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Hi, i was googling for answers until i read this thread from http://mailman.unixodbc.org/pipermail/unixodbc-support/2005-November.txt and we have similar problem: >From nick.gorham at easysoft.com Tue Nov 15 17:49:08 2005 From: nick.gorham at easysoft.com (Nick Gorham) Date: Tue, 15 Nov 2005 17:49:08 +0000 Subject: [unixODBC-support] unixODBC causing FreeTDS to crash or..? In-Reply-To: <[email protected]> References: <[email protected]> Message-ID: <[email protected]> Tr?lnes AS wrote: >Hello! > >I am running asterisk using unixODBC and FreeTDS against MSSQL. I get an >error saying: > >[ODBC][9136][SQLExecute.c][354] > Exit:[SQL_ERROR] > DIAG [24000] [FreeTDS][SQL Server]Invalid cursor state > >I have asked the FreeTDS mailing list and they think this can be caused by >"2 active statement on same connection". This seems to be the case since >there are 2 statements executed according to the unixODBC log prior to the >error. > >So since asterisk is using unixODBC and unixODBC is using FreeTDS I wonder >if the problem could be in unixODBC? I mean: asterisk is probably using 1 >odbc connection (unixODBC) and trust unixODBC to handle multiple threads to >that connection. Or what do you think? > > Its a driver thing. The TDS protocol only allows one current active statement. Sounds like the app is trying to use two. Its not down to the driver manager to manage this, and its unlikly to be related to threads. -----------------------------> ok i'm lost i didn't find an answer for my problem. was this problem solved? this is my script: $conn=odbc_connect($db_host,$db_user,$db_pass); $sql="SELECT * FROM gages where company = '$custid' and gage_sn = '$sn'"; //echo $sql; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} if (odbc_fetch_row($rs)) { $cal=odbc_result($rs,"gage_sn"); $cust=odbc_result($rs,"attribute1"); $sn=odbc_result($rs,"gage_id"); $loc=odbc_result($rs,"crib_number"); $dept=odbc_result($rs,"department"); $mfg=odbc_result($rs,"manufacturer"); $model=odbc_result($rs,"model_num"); $typ=odbc_result($rs,"gage_type"); $active=odbc_result($rs,"isactive"); $wo=odbc_result($rs,"current_wo_number"); $status=odbc_result($rs,"event_status"); $notes=odbc_result($rs,"gage_notes"); ?> <table width="95%" align="center"> <tr> <td><span class="B12DarkBlue">GAGES <?=$cal?> ( <? echo $_SESSION['custid'] ?> )</span></td> </tr> <tr> <td><hr size="1"/></td> </tr> </table> <table width="95%" border="0" align="center"> <tr> <td height="29" colspan="15" class="R11DarkGray"> <table width="100%" align="center" class="TableBorder"> <tr><td class="R11DarkGray"> <img src="images/icon_library.gif" alt="notes" width="28" height="28" align="absmiddle" /> View equipment details with the last calibration events </td></tr> </table></td> </tr> <tr valign="top"> <td width="21%"> <? $sql1="SELECT * FROM mpc_web_users where user_name = '$userid'"; $rs1=odbc_exec($conn,$sql1); //if (!$rs1) // {exit("Error in SQL");} on line 64 odbc_exec() didn't work and that's when the error occurred. i have many scripts like that, some worked and some aren't i really need a one time solution rather than re-programming my scripts. Thanks in advance. -- R