Two additional notes regarding ODBC connections to a Network Sybase SQL Anywhere 8 Server..
I wrote a script using the PHP5 CLI binary that monitors a directory for changes, then updates a Network Server SQL Anywhere 8 database when a change was detected. Idealy, my program would run indefinately, and issue odbc_connect()/odbc_close() when appropriate. However, it seems that once connected, your odbc session is limited to 30 seconds of active time, after which, the connection becomes stale, and no further queries can be executed. Instead, it returns a generic "Authentication violation" error from the odbc driver.
Here's an example:
<?php
$conn=odbc_connect($connect_string,'','');
$result=odbc_exec($qry,$conn); sleep(31);
$result=odbc_exec($qry,$conn); ?>
Additionally, it seems that odbc_close() doesn't truely close the connection (at least not using Network SQL Anywhere 8). The resource is no longer usable after the odbc_close() is issued, but as far as the server is concerned, there is still a connection present. The connection doesn't truely close until after the php script has ended, which is unfortunate, because a subsequent odbc_connect() commands appear to reuse the existing stale connection, which was supposedly closed.
My workaround was to design my script exit entirely after a the database update had completed. I then called my script whithin a batch file and put it inside an endless loop.
I'm not sure if this is a bug with PHP or what, but I thought I'd share in case someone else is pulling their hair out trying to figure this one out...