RE: Connection.setBytes()

Поиск
Список
Период
Сортировка
От Peter Mount
Тема RE: Connection.setBytes()
Дата
Msg-id 1B3D5E532D18D311861A00600865478CF1B0F4@exchange1.nt.maidstone.gov.uk
обсуждение исходный текст
Ответ на Connection.setBytes()  (Matt Fair <matt@netasol.com>)
Список pgsql-interfaces
Yes, now I look more closely yes, the finally clause does close the
connection, which is why you get the NullPointerException.

Peter

--
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council


-----Original Message-----
From: Joachim Achtzehnter [mailto:joachim@kraut.bc.ca]
Sent: Tuesday, July 18, 2000 8:48 PM
To: pgsql-interfaces@postgresql.org
Subject: Re: [INTERFACES] Connection.setBytes()


On Tue, 18 Jul 2000, Matt Fair wrote:
>
> Here is the code I am using:
> 
>     public PsqlConsole(String url) {
>         try{
>             ... 
>             con = DriverManager.getConnection("jdbc:postgr...");
>             con.setAutoCommit(false);
>         }
>         catch(ClassNotFoundException e) {
>             ...
>         }
>         catch(SQLException e) {
>             ...
>         }
>         finally {
>             //always close the database
>             try {
>                 if(con != null) con.close();

This closes the connection! Once this method returns your connection is
closed. Your subsequent SQL calls in the prompt() method use a closed
connection.

Joachim


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

Предыдущее
От: Peter Mount
Дата:
Сообщение: RE: Connection.setBytes()
Следующее
От: Peter Mount
Дата:
Сообщение: RE: Searching Blobs