This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Limit on number of statements exceeded Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Limit on number of statements exceeded" Watch "Limit on number of statements exceeded" New topic
Author

Limit on number of statements exceeded

Daniel Eriksson
Greenhorn

Joined: Oct 25, 2004
Posts: 5
Hi,

I have a problem with the number of open PreparedStatements on a JDBC connection (JTOpen).
java.sql.SQLException: Limit on number of statements exceeded.

The problem comes from a large number of statements being executed on the same connection before it is returned to the pool. I am pretty sure that i close all statements and resultsets after use, but I might have missed it somewhere.

Is it possible to get the number of open statements for a particular Connection ?

So that i can monitor number of open statements at certain points during the execution ...
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Originally posted by B. Daniel Eriksson:
Hi,

I have a problem with the number of open PreparedStatements on a JDBC connection (JTOpen).
java.sql.SQLException: Limit on number of statements exceeded.

The problem comes from a large number of statements being executed on the same connection before it is returned to the pool. I am pretty sure that i close all statements and resultsets after use, but I might have missed it somewhere.

Is it possible to get the number of open statements for a particular Connection ?

So that i can monitor number of open statements at certain points during the execution ...


Not really no. Sounds to me like there are in fact alot of statements at least left lying open. Which probably means it is time to revisit all your code and probably your design in detail to see why this is happening.
 
Don't get me started about those stupid light bulbs.
 
subject: Limit on number of statements exceeded
 
Similar Threads
How many statements we can open with that particular connection
How many statements we can create from a single connection
Need some idea on how to determine the no. of SQL connections that is left open(all across the apln)
Closing Statement object prior to committing
"Limit No of Statements Exceded"