aspose file tools*
The moose likes JDBC and the fly likes DataSource - Flush Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "DataSource - Flush" Watch "DataSource - Flush" New topic
Author

DataSource - Flush

Juan Marino
Greenhorn

Joined: Jul 26, 2010
Posts: 4
Hello everybody!!! Well, here comes my question....

I've been working with a DataSource in Glassfish but I'm wondering if is there any way in which I could make a flush from code?...
I mean... Yoou can make the container validate the connection, but that produces overhead.. so it is possible to catch an exception and
make a flush in that moment?

And forgive me for my bad English... :O
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I'm not sure I understand what you mean by "flush" - what is it you want this to do?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Juan Marino
Greenhorn

Joined: Jul 26, 2010
Posts: 4
flush -> Restart the pool... Restart all the connections
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Disconnecting and reconnecting is the only way to do this. Because you have a connection pool you will not actually know if the connection is actually closed or just returned to the pool.

I can't think of a reason why you would want to do this though. What is driving this requirement?
Juan Marino
Greenhorn

Joined: Jul 26, 2010
Posts: 4
I´m working on "electronic funds transfer", and my boss was asking me about it
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Why does your boss believe you need to close all connections in the pool and reopen? Seems like a fairly odd requirement, its possible she/he is misunderstanding how databases work?
Juan Marino
Greenhorn

Joined: Jul 26, 2010
Posts: 4
If in any moment the DataBase is restarted, all the connections in the pool are lost and there is no way in which we can restart those connections but validating it by Glassfish
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Connection pool implementations can usually recover from this. I don't know GlassFish that well, but I'd be surprised if it doesn't have this feature. Worth a look in the docs.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DataSource - Flush
 
Similar Threads
How to integrate SQL server with JBOSS
problems with Session.save()
Cleaning keyboards
Problem oin connecting Oracle database in JBOSS AS 4.2.3
JPA Detected reentrant flush exception