Getting ODBC openlink 37000 in odbc_do($conn,"$sql") but odbc_tables($conn) works? Help!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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();

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux