Re: Where should I connect to the database?

From: "Jayesh K(dot) Parayali" <jparayali(at)TOTALFLOOD(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Where should I connect to the database?
Date: 2001-11-23 17:22:01
Message-ID: 8ACB76BF6B98C94FB6959B660C051BA50C9BAD@PACIFIC.TOTALFLOOD.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Option 2 if you want your application to scale.

-----Original Message-----
From: Dino Cherian [mailto:inimss(at)yahoo(dot)com]
Sent: Friday, November 23, 2001 4:12 AM
To: pgsql-jdbc(at)postgresql(dot)org
Subject: [JDBC] Where should I connect to the database?

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

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vicktor 2001-11-23 17:50:54 Re: Where should I connect to the database?
Previous Message Dave Cramer 2001-11-23 14:38:03 Re: How to pass ResultSet in RMI ?