Where should I connect to the database? - Mailing list pgsql-jdbc

From Dino Cherian
Subject Where should I connect to the database?
Date
Msg-id 20011123121150.58254.qmail@web21009.mail.yahoo.com
Whole thread Raw
Responses Re: Where should I connect to the database?  ("Dave Cramer" <Dave@micro-automation.net>)
Re: Where should I connect to the database?  (Vicktor <vic@adv.ru>)
Re: Where should I connect to the database?  ("Nick Fankhauser" <nickf@ontko.com>)
List pgsql-jdbc
Hi all,

I would like to know which one is the best method of
managing database connection in Java 1.3 (with
PostgreSQL 7.1.2 JDBC).

Option 1:
    Connect to the database in the "main" function and
disconnect on program exit. Use it throughout the life
of the application. "Connect once and use for ever".

Option 2:
    Connect to the database near the code that uses it
and disconnect after that block of code. "Use and
throw away".

Please help me.

Thanks
Dino

__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

pgsql-jdbc by date:

Previous
From: Dino Cherian
Date:
Subject: Re: Stalled post to pgsql-jdbc
Next
From: "Per Ivansson"
Date:
Subject: postgreSQL functions and postgres JDBC