Need help with a OpenLink ODBC driver error again
| From: | Don Myers | Date: | Mon, 06 Oct 2003 13:23:27 +0000 |
| Subject: | Need help with a OpenLink ODBC driver error again | ||
| Groups: | php.db php.db | ||
| Request: | Send a blank email to php-db+get-30880@lists.php.net to get a copy of this message | ||
Ok this time I checked the SQL select syntax! So I hope it's not something
that easy again (Well actually easy would be nice....)
The other day I Posted a email question about getting a 37000 sql error but
my sql syntax was wrong. Yes I felt stupid but this time I corrected the
syntax and I am still getting an error but, the error is that the web
browser "times-out" trying to get the page. (Nothing displayed and a browser
error
"Could not open the page ³http://127.0.0.1/tests/odbc.php² because Safari
could not load any data for this location."
I get the same type of thing with Internet Explorer.
Here is a recap.
I am using iodbc from openlink on OS X and everything seems fine. I can get
and display tables with:
$results = odbc_tables($conn) or die("<P>".odbc_errormsg());
odbc_result_all($results) or die("<p>pulling result error");
(full syntax below)
But when I switch to
$results = odbc_exec($conn,$sql) or die("<p> captured ".odbc_errormsg());
odbc_result_all($results) or die("<p>pulling result error");
I get an:
"Could not open the page ³http://127.0.0.1/tests/odbc.php² because Safari
could not load any data for this location."
Any ideas? Why tables work but SQL Select doesn't?
Also I have a 5 user openlink license. how do I reset the connections after
I get 5 errors because I think the connections are not dropped when PHP gets
an error? The only way I can get to 5 lic. Limit to reset is to restart os
x? Sudo apachectl restart doesn't seem to work either?
Full Syntax:
<?
odbc_close_all();
putenv("DYLD_LIBRARY_PATH=/usr/lib/libiodbc.dylib");
putenv("ODBCINSTINI=/Library/ODBC/odbcinst.ini");
putenv("ODBCINI=/Library/ODBC/odbc.ini"); //odbc.ini contains your DSNs.
$dsn="DSNname"; // this is a valid DSN can be tested in odbctest
$user="name";
$password="password";
$sql="SELECT * FROM tblDepartments";
$conn=odbc_connect("$dsn","$user","$password") or die
("<p>couldn't
connect");
echo "connected to DSN: $dsn";
echo "<BR><b>SQL:</b> $sql<BR>";
//$results = odbc_exec($conn,$sql) or die("<p> captured ".odbc_errormsg());
$results = odbc_tables($conn) or die("<P>".odbc_errormsg());
odbc_result_all($results) or die("<p>pulling result error");
echo "closing connection $conn";
odbc_close($conn);
odbc_close_all();
?>
Don Myers