Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.


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


asked 28 Sep '15, 10:39

robert's gravatar image

accept rate: 0%

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.

permanent link

answered 28 Sep '15, 10:55

Mikel%20Rychliski's gravatar image

Mikel Rychliski
accept rate: 32%

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.


(28 Sep '15, 16:54) robert
Replies hidden

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:

Does the error still occur with DYNAMIC_PREPARE=false set?

Thanks, Mikel

(29 Sep '15, 08:31) Mikel Rychliski

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

(07 Oct '15, 14:53) robert
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 28 Sep '15, 10:39

question was seen: 6,443 times

last updated: 07 Oct '15, 14:53