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