Re: Where should I connect to the database?

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: Where should I connect to the database?
Дата
Msg-id 000d01c1742a$deb532f0$8201a8c0@inspiron
обсуждение исходный текст
Ответ на Where should I connect to the database?  (Dino Cherian <inimss@yahoo.com>)
Список pgsql-jdbc
Dino,

I tend to get a connection when I need it, and release it right away. It
sort of depends on what you are doing. My applications are servlets, so
the connections need to be shared with users. To this end I use a
connection pool.

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Dino Cherian
Sent: Friday, November 23, 2001 7:12 AM
To: pgsql-jdbc@postgresql.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



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Per Ivansson"
Дата:
Сообщение: postgreSQL functions and postgres JDBC
Следующее
От: "Dave Cramer"
Дата:
Сообщение: Re: How to pass ResultSet in RMI ?