cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Anywhere Error -685: Resource governor for 'prepared statements' exceeded

huber1
Participant
0 Kudos
6,941

Hi

At startup of our application, I get this error: SQL Anywhere Error -685: Resource governor for 'prepared statements' exceeded

Where can I limit these mentioned prepared statements?

  • SQL Anywhere 16
  • OS X 10.10.5
  • Java 1.8.0_60

Robert

Accepted Solutions (0)

Answers (1)

Answers (1)

By default, each connection is limited to 50 simultaneous prepared statements.

Ensure that your application is closing result sets and statements when it's done with them, so they don't continue to use resources on the server.

If you really need more then 50 simultaneous prepared statements, you can adjust the max_statement_count option.

huber1
Participant
0 Kudos

Hi Mikel

Thank your for your thoughts. I used SQL Anywhere 11 and 12 with a jconn3.jar driver in productive environments for years and never had this error message. Now, I changed one server to SQL Anywhere 16 and jconn4.jar and I do get this message. I do not get this message if I use the jconn3.jar with SQL Anywhere 16. That leads me towards the thinking it has something to do with the SQL Anywhere 16 database.

Robert

0 Kudos

Hi Robert,

In jConnect 16 the default value of the DYNAMIC_PREPARE Connection Property changed from false to true. Perhaps you never saw the error on previous versions because SQL statements were not being prepared dynamically.

See the following page for further details: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.help.jc.16.0/doc/html/title...

Does the error still occur with DYNAMIC_PREPARE=false set?

Thanks, Mikel

huber1
Participant
0 Kudos

Hi MIkel

Setting max_statement_count to 200 lead to no error any more. Setting it to 0 works as well. I set it to 200 as this seems more logical to me.

Where is the DYNAMIC_PREPARE=false set? Is it an environment variable?

Best regards Robert