• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

transactions/statements per connection

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic