-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Lifecycle of PreparedStatements in connection pool (eg.c3p0)
PostPosted: Mon Mar 29, 2010 12:46 pm 
Beginner
Beginner

Joined: Wed Sep 06, 2006 12:08 pm
Posts: 48
Location: Warsaw - Poland - Europe - Milky Way
Hello

I’m afraid I don’t understand a lifecycle of PreparedStatements cached by connection pool (for example c3p0).

Let assume that we have a first database session.
This session is querying a database using a following SQL: SELECT ID FROM TABLE
Hibernate will generate a PreparedStatement for this query.

Question 1
Is this prepared statement can be reused and can be shared by other database sessions?

Question 2
Let assume that my first session is broken (network error for example). Then this session will be closed by Hibernate (or c3p0) due to fatal error occurred for this particular session.
What will happen with all prepared statements created by my first session?
Will all PreparedStatements will be destroyed too during closing this first session?
Or maybe PreparedStatements can live longer than session which created this PreparedStatements?

Kind regards,
Adam

PS.
This question is related to JDBC Statements / PreparedStatements performance consideration described in this article:
Java Programming with Oracle JDBC - Chapter 19 Performance
http://oreilly.com/catalog/jorajdbc/chapter/ch19.html

PS II.
This is related to Hibernate setting:
hibernate.c3p0.max_statements


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.