Getting ODBC openlink 37000 in odbc_do($conn,"$sql") but odbc_tables($conn) works? Help!
| From: | Don Myers | Date: | Fri, 03 Oct 2003 04:40:55 +0000 |
| Subject: | Getting ODBC openlink 37000 in odbc_do($conn,"$sql") but odbc_tables($conn) works? Help! | ||
| Groups: | php.db php.db | ||
| Request: | Send a blank email to php-db+get-30811@lists.php.net to get a copy of this message | ||
I am using iodbc from openlink on OS X and everything seems fine and I can
get the database tables with
$results = odbc_tables($conn) or die("<P>".odbc_errormsg());
And print them to the screen with
odbc_result_all($results) or die("<p>printing result error");
But when I try
$sql="select * form tblJobStatus";
$results = odbc_do($conn,$sql) or die("<p> captured ".odbc_errormsg());
I get
Warning : odbc_do(): SQL error: [OpenLink][ODBC][Driver]Syntax error or
access, SQL state 37000 in SQLExecDirect in
/Library/WebServer/Documents/tests/odbc.php on line 6
captured [OpenLink][ODBC][Driver]Syntax error or access
I have a "good" connection because the table pull is right but how come the
sql select is broken?
D Myers
<?
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="testdsn"; // this is a valid DSN can be tested in odbctest
$user="user";
$password="password";
$sql="select * form tblJobStatus";
$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_do($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();