Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / July 2005

Tip: Looking for answers? Try searching our database.

DB Connection Timeouts

Thread view: 
Dave Brown - 13 Jul 2005 20:24 GMT
Hi All,

I'm quite new to j2se apps but have started doing one using swing for
the gui. Anyway my previous work has been mainly J2EE apps where I
always create a new connection to the DB using jdbc/connection pooling.

I've taken the same approach in my desktop application, each time I need
to perform a query/update etc I create a new connection, do the work,
then close it.

I was wondering if there really is any need to create a new connection
everytime.. Since I'm using a local database to the app anyway (hsqldb),
would it be wiser to create one connection when my app starts and just
use that each time.. Or would there still be a chance of it timing out.

Thanks for any responses in advance.

Dave
joeNOSPAM@BEA.com - 14 Jul 2005 03:06 GMT
As long as your program is running, your connection should be good,
unless the DBMS is multiuser and closes long-idle connections, or
you are going through a firewall that is doing the same thing.

Joe Weinstein at BEA
Thomas Hawtin - 14 Jul 2005 22:19 GMT
> I was wondering if there really is any need to create a new connection
> everytime.. Since I'm using a local database to the app anyway (hsqldb),
> would it be wiser to create one connection when my app starts and just
> use that each time.. Or would there still be a chance of it timing out.

It may well not make a great deal of difference for a local application.

Some time ago I wrote a call center app. The database closed idle
connections, so I checked them everytime I started an operation. On one
occassion we had the server power cycled, but we didn't lose any data at
all still on the client side.

Tom Hawtin
Signature

Unemployed English Java programmer

Arnaud - 19 Jul 2005 16:10 GMT
What you could do is use a connection pool to manage the connection. The
DBCP API from Apache is a good one.

--
Arnaud


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.