| Author |
transactions/statements per connection
|
Ishita Gupta
Greenhorn
Joined: Jan 03, 2003
Posts: 18
|
|
Hi Everybody, I have heard that JDBC allows only one active transaction or statement object per connection. Why is there such a limitation. I am sure this limitation needs to be understood for a thorough use of the JDBC, as such. Thanx in advance.
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
like_java, Welcome to JavaRanch! We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy. Thanks Pardner! Hope to see you 'round the Ranch!
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
Vamshi Krishna
Greenhorn
Joined: Apr 22, 2003
Posts: 4
|
|
Hi, I am working upon Java these days. I could not found any restruction as you said. I think you can have two or more statements objects for a single connection object. If you think we can not or found a reason that we can not do that, please let me know about it. I am looking forward for the reason if we can not create muntiple statement objects on a single connection object. Hope you get back to me. Your help is appreciated
|
Krishi.
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
You can have multiple Statement objects per Connection. No problem there. However, when it comes to transactions, things get more complicated and there are probably many database drivers that cannot cope with two transactions over a single connection. I remember reading a thread here at JavaRanch about this issue of of connection sharing with multiple transactions. [ June 17, 2003: Message edited by: Lasse Koskela ]
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
Jamal Anvar
Greenhorn
Joined: May 15, 2003
Posts: 1
|
|
Hi Ishita, You can create any number of statements using the same connections at a time. Each statement can have a resultset each at a time. There is no limit as such except the database level limits like max number of open cursors etc. But I think you cant run two SQL statements using two statements at a time concurrently (possibly using different threads as in servlets). I think this is restricted by database and not driver. If you fire two SQLs using different statements out of the same connection, the second one will wait for the first one to complete the execution. I have based Oracle database in my explanation. Does any one have any other explanation for this?
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: transactions/statements per connection
|
|
|