Re: PHP + OPENLINK ERROR

From: Date: Mon, 11 Dec 2000 17:31:37 +0000
Subject: Re: PHP + OPENLINK ERROR
References: 1  Groups: php.install 
Request: Send a blank email to php-install+get-1141@lists.php.net to get a copy of this message
Hi Andrew, Unfortunately (or not, since it woud means to change finished applications ;-)) your solution did not work. I tryed the code below but the error message is still the same. Looking around I saw that a lot of users have related this same problem with Openlink ODBC and PHP4. Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in SQLPrepare in /software/apache/htdocs/aplic/teste/teste.htm on line 25 Here's the new code: <? $db = odbc_connect("DSN=Producao;UID=notes" , "" , ""); $query = "select nomefunc, matrica from srhtb002"; $queryprep = odbc_prepare ($db, $query); // Line 25 $result = odbc_execute($queryprep ); print "ok. result = $result"; $nextrow = odbc_fetch_row($result, 1); if (! $nextrow ) { print "Não achou nada...<br>"; } else { print odbc_result($result , 1 ); print "<br>"; print odbc_result($result , 2 ); } ?> Lets see if we can fix this, ok? Best regards, André Felipe Andrew Hill wrote: > Hi Andre, > > How is it going ! :) > > I believe that you are experiencing a known issue with odbc_do and > odbc_exec. > These functions "directly execute" e.g. they do not first prepare a > statement. > > Try using odbc_prepare followed by odbc_execute, to see if this makes a > difference. > > I have not dug much deeper into the problem, but swapping in a prepare seems > to resolve it. > > Please let me know how you get on with this. > > Best regards, > Andrew > ---------------------------------------------------- > Andrew Hill > Director Technology Evangelism > OpenLink Software > http://www.openlinksw.com > XML & E-Business Infrastructure Technology Provider > > > -----Original Message----- > > From: Andre Felipe [mailto:Andre.Felipe@embrapa.br] > > Sent: Monday, December 11, 2000 12:00 PM > > To: ahill@openlinksw.com > > Cc: Georges da Mata Claessen; php-install@lists.php.net > > Subject: Re: [PHP-INST] PHP + OPENLINK ERROR > > > > > > Hi Andrew, remember me? > > > > In fact, this problem isnt exactlty THE problem. > > We're using here PHP 3.0.12 with Openlink Version 2.7B (Release > > 3.2) as of Fri Nov 26 1999 (cvsid 00050). > > The REAL problem is that when we upgrade to PHP 4.0 or higher the > > odbc functions dont work anymore. The error message is: > > Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or > > access, SQL state 37000 in > > SQLExecDirect in > > /software/apache/htdocs/aplic/teste/teste.htm on line 25 > > > > I had posted a message earlier about this problem, but had no > > responses. Here's the message: > > Hi friends, > > after some digging I've found that to compile PHP 4.0.2 (or > > 4.0.3PL1 or 4.0.4RC4) with Openlink > > ODBC on Sun Solaris we must alter > > php_odbc.c, changing: > > "SQLINTEGER len" to "SDWORD len". > > > > Ok, it now compiles. But ODBC functions that used to work in PHP > > 3.0.12 doesn't work anymore. > > The following code gives the error: > > Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or > > access, SQL state 37000 in > > SQLExecDirect in > > /software/apache/htdocs/aplic/teste/teste.htm on line 28 > > > > <? > > $db = odbc_connect("DSN=Producao;UID=notes" , "" , ""); > > $query = "select nomefunc, matrica from srhtb002"; > > $result = odbc_exec ($db, $query); // THIS is line 28 > > print "ok. result = $result"; > > > > $nextrow = odbc_fetch_row($result, 1); > > if (! $nextrow ) { > > print "Nothing...<br>"; > > } > > else { > > print odbc_result($result , 1 ); > > print "<br>"; > > print odbc_result($result , 2 ); > > } > > ?> > > > > Does these ODBC functions changed their sintax ???????? > > > > Best regards, > > André Felipe > > > > > > > > > > Andrew Hill wrote: > > > > > Hi Georges, > > > > > > A couple things could cause this problem - basically you have a > > > configuration problem with Openlink, not PHP. > > > > > > Make sure that you can succesfully test the DSN from the PHP box using > > > odbctest before trying to use a DSN from PHP. > > > > > > The error you have received could be caused by either of the following: > > > - the Service Type in the odbc.ini is not on that is recognized > > > - the ing#_sv or oig#_sv agent on the server side is > > built for the wrong > > > platform, cannot be executed because it's not in a directory with proper > > > permissions, or cannot be found at all. To verify that it is a correct > > > component, try to execute it for a version string: e.g. oig2_sv > > -? if there > > > is a problem here due to bad file type then it's built for the wrong > > > platform. If you get an error that it cannot find a libiodbc.so.1 or > > > something similar, it means you have not set your environment variables > > > before starting the oprlqb. These are contained in openlink.sh - I > > > recommend putting them in your .profile for ease of use. To verify that > > > they are set, try an: env and look for ODBCINI, ODBCINSTINI, and > > > LD_LIBRARY_PATH. > > > You also may need to append the location of the Ingress lib > > directory to the > > > LD_LIBRARY_PATH variable, although this is not strictly > > necessary unless you > > > are trying to connect across build numbers. > > > > > > Start your oplrqb with logging (./oplrqb +loglevel 7) but make > > sure that you > > > have: . ./openlink.sh before you do so, and then examine the > > oplrqb.log > > > after reproducing the problem. You should be able to get more > > info about > > > what is going on. > > > > > > Since this is probably an Openlink configuration issue instead of PHP, > > > please take any future correspondence off-list if you are still > > experiencing > > > problems after trying these suggestions. > > > > > > You can open a free tech support case at > > > http://www.openlinksw.com/support/suppindx.htm > > > > > > Hope this helps. > > > > > > Best regards, > > > Andrew > > > ---------------------------------------------------- > > > Andrew Hill > > > Director Technology Evangelism > > > OpenLink Software > > > http://www.openlinksw.com > > > XML & E-Business Infrastructure Technology Provider > > > > > > > -----Original Message----- > > > > From: Georges da Mata Claessen [mailto:georges@embrapa.br] > > > > Sent: Monday, December 11, 2000 6:35 AM > > > > To: php-general@lists.php.net; php-install@lists.php.net > > > > Subject: [PHP-INST] PHP + OPENLINK ERROR > > > > > > > > > > > > I'm getting this error using PHP 4 with OPENLINK under Solaris 2.7 > > > > > > > > Warning: SQL error: [OpenLink][ODBC]unable to contact the requested > > > > database agent, SQL state 08004 in SQLConnect > > > > in /software/apache/htdocs/estagio/teste/testedesenv.htm on line 2 > > > > > > > > Warning: Supplied argument is not a valid ODBC-Link resource in > > > > /software/apache/htdocs/estagio/teste/testedesenv.htm on line 6 > > > > > > > > We compiled PHP using OPENLINK and we got some errors on the > > > > compilation. Under PHP 3, we could contact the database properly, via > > > > ODBC, but with PHP 4 we always get this error. > > > > > > > > Please if someone from Openlink could help I would be very > > gratefull. We > > > > are using Ingres here. > > > > > > > > Georges. > > > > > > > > > > > > -- > > > > PHP Install Mailing List (http://www.php.net/) > > > > To unsubscribe, e-mail: php-install-unsubscribe@lists.php.net > > > > For additional commands, e-mail: php-install-help@lists.php.net > > > > To contact the list administrators, e-mail: > > php-list-admin@lists.php.net > > > > > > > > > > > > > > > > > > -- > > > PHP Install Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-install-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-install-help@lists.php.net > > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > > -- > PHP Install Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-install-unsubscribe@lists.php.net > For additional commands, e-mail: php-install-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.install (#1141) next »