Jump to content

Problems with odbc_exec and sybase


davemere

Recommended Posts

Hi y'all

 

I'll keep this simple! Here's my code:

 

$conn = odbc_pconnect("conn", "id", "pwd");

if (odbc_error()) { 	
echo "Connection failed <br>";  
exit;   
}
else {
echo "Connection successful";    
};

$qry = "SELECT count(*) FROM <table>";
$result = odbc_exec($conn, $qry);
echo odbc_result($result,1); 

 

Here's the result!

Connection successful

Warning: odbc_exec() [function.odbc-exec]: SQL error: [sybase][ODBC Driver]Optional feature not implemented, SQL state HYC00 in SQLSetStmtOption in C:\www\sybconnect-odbc.php on line 20

 

Warning: odbc_result(): supplied argument is not a valid ODBC result resource in C:\www\sybconnect-odbc.php on line 21

 

This should be so simple!! It can't be a code problem. Can anyone offer a hint as to what feature I'm missing?

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/81712-problems-with-odbc_exec-and-sybase/
Share on other sites

Hi Dave, if the query is working, you can always mask that error and make it no longer show by using a magic little thing in php:

 

Just add a @ symbol before the query and you will no longer see that error. Please note however that although the error wont show, it doesn't mean it isn't still there :D

 

Shaun

From the manual for odbc_error() - "This function returns meaningful value only if last odbc query failed." Calling odbc_error after the query might provide additional information about the connection.

 

You need to test the resource returned by the odbc_connect() to find if the connection worked.

 

Is the first parameter in your odbc_connect() the name of a DSN that you have setup?

From the manual for odbc_error() - "This function returns meaningful value only if last odbc query failed." Calling odbc_error after the query might provide additional information about the connection.

odbc_error returns this message: [sybase][ODBC Driver]Optional feature not implemented

 

 

You need to test the resource returned by the odbc_connect() to find if the connection worked.

Sure. Does the following line not provide a test of the resource? How else might I do it if necessary?

$result = odbc_exec($conn, $qry)

 

 

Is the first parameter in your odbc_connect() the name of a DSN that you have setup?

Yes. It's the name of a ODBC data source, tested it with MS Access and it works

 

 

?????? I think I'm going to try java instead. PHP/Sybase is beginning to frustrate...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.