Received: from web21002.mail.yahoo.com (web21002.mail.yahoo.com [216.136.227.56]) by postgresql.org (8.11.3/8.11.4) with SMTP id fAKA9xm04104 for ; Tue, 20 Nov 2001 05:09:59 -0500 (EST) (envelope-from inimss@yahoo.com) Message-ID: <20011120101000.65421.qmail@web21002.mail.yahoo.com> Received: from [203.115.108.7] by web21002.mail.yahoo.com via HTTP; Tue, 20 Nov 2001 02:10:00 PST Date: Tue, 20 Nov 2001 02:10:00 -0800 (PST) From: Dino Cherian Subject: When to connect and disconnect Connection To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200111/290 X-Sequence-Number: 5672 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