RE: [PHP-DB] iodbc + php4

From: Date: Thu, 27 Jul 2000 12:58:53 +0000
Subject: RE: [PHP-DB] iodbc + php4
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-1569@lists.php.net to get a copy of this message
Hi Andrew, You should be able to tell iODBC to trace by: 1. setting UDBCINI and ODBCINI envrironment variables to the odbc.ini you are using. 2. putting the following section at the top of your odbc.ini file: [UDBC] DebugFile=/tmp/debug.out (or whatever filename) Also, I've been seeing quite a few people with problems using odbc_exec or odbc_do with PHP4. Odbc_exec and odbc_do are functions that 'directly execute' your SQL statement, meaning that after the connection is opened the statment is fed in, compiled, a query plan is created, stored in temp space, and then executed. This is a rather expensive way to perform queries, but most people use it because in involves less coding. I would try a combination of odbc_prepare and odbc_execute, which will allow you to first prepare the statement, eg. compile it in the db envrionemnt, and then later (or immediatley) execute it. The benefit here is that if you set up your logic to use groups of similar queries, then you can odbc_prepare a statement with a parameter in it, and then pass that parameter in when calling odbc_execute. This allows you to call odbc_execute as often as you want with new parameters, without paying the performance price of recompiling, creating an execution plan, and storing the query. Granted this may only be a second or less, but it can add up, and it can be longer than that if the query is ponderous or the db engine is not optimal. Hope this helps! Best regards, Andrew ---------------------------------------------------- Andrew Hill Professional Services Consultant OpenLink Software http://www.openlinksw.com Universal Database Connectivity Technology Providers -----Original Message----- From: Andrew Smith [mailto:asmith@cadre.com.au] Sent: Wednesday, July 26, 2000 9:13 PM To: Php DB Subject: [PHP-DB] iodbc + php4 Hi All, Anyone run into intermittent errors like the following? Warning: SQL error: [iODBC][Driver Manager]Function sequence error, SQL state S1010 in SQLAllocStmt in /home/sites/site6/web/pingodbc.php on line 10 I've tried the following combinations php4.0.1pl2 + iodbc 3.0.2 php4.0.1pl2 + iodbc 2.50.3 php4.0.1RC2 + iodbc 3.0.2 php4.0.1RC2 + iodbc 2.50.3 But I get the same problem on all of them. The error occurs more often than the result set is returned. All the env vars are present and it successfully connects every time, the error occurs on the odbc_exec. Here's my test script for querying any MSSQL DB (since sysobjects is a system table) <? if ($connID = odbc_connect($HTTP_GET_VARS['dsn'], $HTTP_GET_VARS['usr'], $HTTP_GET_VARS['pass'])) echo "Connection Established"; else echo "Connection Failed"; if($HTTP_GET_VARS['query']=='y') { $res = odbc_exec($connID,"SELECT * FROM sysobjects"); odbc_result_all($res); } ?> Anyone come across this? Andrew -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#1569) next »