This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes Is there a limit  to # of Statements over a Connection object Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Is there a limit  to # of Statements over a Connection object" Watch "Is there a limit  to # of Statements over a Connection object" New topic
Author

Is there a limit to # of Statements over a Connection object

Vasilis Karas
Greenhorn

Joined: Mar 16, 2004
Posts: 24
Is there a limit or performance pitfall I need to be aware of in terms of how many Statement(PreparedStatements) objects I should create over one Connection object? Currently I have a singleton class where my DB calls are made from. When instantiating the class through static method, I pass in a Connection object that creates about ten preparedstatement objects. Is there a limit of how many Preparedstatements I should restrict a Connection to?
Al Tam
Greenhorn

Joined: Nov 27, 2004
Posts: 5
It depends on the database that you are using.

Which DB are you using? Oracle?
Vasilis Karas
Greenhorn

Joined: Mar 16, 2004
Posts: 24
Al, thanks for responding.
We're using MS SQL server.

thanks again.
VK
Caitlin Fourie
Greenhorn

Joined: Oct 03, 2003
Posts: 3
Is it true that a connection is limited in the amount of statements it can handle according to type of database?
Surely a connection, as long as it is kept alive and statements are correctly closed, can handle an unlimited amount of PreparedStatement and Statement objects regardless of db type, or how else would pooled connections work efficiently?
I'm interested to know which particular databases do impose limits... maybe I've been using Connection objects incorrectly all along...
Vasilis Karas
Greenhorn

Joined: Mar 16, 2004
Posts: 24
I'm not sure but the way I've built each singleton class with ten or more PreparedStatements over a connection I was growing concerned.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there a limit to # of Statements over a Connection object
 
Similar Threads
reasons for error: SQLException: No operations allowed after connection closed?
getting the resultset of a stored procedure?
PreparedStatement with Connection Pooling
How many objects can you create in JVM with very large RAM.
JSP and JDBC