Question

I'm working on a project where I am required to query a database using PHP ODBC methods via OpenEdge Progress drivers. I need a way to set the timeout on the MySQL query so it is much shorter than the default settings (if there even is one).

I tried using "odbc_setoption($stmt, 2, 0, 30)", as in the example statements below...

  $stmt = odbc_prepare($this->odbc, $query);
  odbc_setoption($stmt, 2, 0, 30);//Set query timeout to 30 seconds.
  return odbc_execute($stmt);

But that failed because "0" is unsupported as the option for query timeout. I'm not aware of the number, I tried everything including attempting to set it in my database connections DSN string and via the registry. Any ideas on the variable name and or option number in PHP? Nobody uses this thing...

Thanks

Was it helpful?

Solution

you can set the timeout direct with your SQL script.

for current connection:

SET PRO_CONNECT QUERY_TIMEOUT n ; 

for database until is running:

SET PRO_SERVER QUERY_TIMEOUT n ;

http://documentation.progress.com/output/OpenEdge102b/pdfs/dmsrf/dmsrf.pdf page 58

but that probably know you ;)

OTHER TIPS

Did you try use ADOdb instead of using native php odbc support?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top