pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dino Cherian <inimss@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: When to connect and disconnect Connection
Date: Tue, 20 Nov 2001 02:10:00 -0800 (PST)
Message-ID: <20011120101000.65421.qmail@web21002.mail.yahoo.com> (raw)

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



Message-ID: <20011120101000.65421.qmail@web21002.mail.yahoo.com>
Permalink:  ../20011120101000.65421.qmail@web21002.mail.yahoo.com/
Also on:    postgresql.org/message-id/20011120101000.65421.qmail@web21002.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: inimss@yahoo.com
  Subject: Re: When to connect and disconnect Connection
  In-Reply-To: <20011120101000.65421.qmail@web21002.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox