Skip site navigation (1) Skip section navigation (2)

Re: JDBC causing the connection to close after executing a COPY command

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Altaf Malik <mmalik_altaf(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC causing the connection to close after executing a COPY command
Date: 2007-12-13 15:37:10
Message-ID: 33B38B63-7DB9-405B-A808-0152A5DB6295@fastcrypt.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Altaf,
On 13-Dec-07, at 10:24 AM, Altaf Malik wrote:

> Hi,
>  JDBC is causing the connection to close on executing a simple COPY  
> query which the driver does not support. The code shows that driver  
> throws an exception however explicitly the connection is not closed.  
> Consider the following case.
> <code>
> Class.forName("org.postgresql.Driver");
> Connection con = DriverManager.getConnection("jdbc:postgresql:// 
> localhost/postgres","altaf","");
>
> Statement stmt = con.createStatement();
> stmt.execute("create table abc(a int4)");
> try{
>         stmt.execute("COPY abc TO STDOUT WITH DELIMITER '|'");
>         }catch(Exception e) {
>             e.printStackTrace();
>         }
>         stmt.execute("Select * from abc");
>
> </code>
>
> Can anybody tell what's happening?
>
At what point can you determine the connection is closed ? Can you do  
con.createStatement after the exception ?

Dave
> Thanks,
> Altaf Malik
> EnterpriseDB
> http://www.enterprisedb.com/
>
> Looking for last minute shopping deals? Find them fast with Yahoo!  
> Search.

In response to

Responses

pgsql-jdbc by date

Next:From: Altaf MalikDate: 2007-12-13 15:54:52
Subject: Re: JDBC causing the connection to close after executing a COPY command
Previous:From: Altaf MalikDate: 2007-12-13 15:24:57
Subject: JDBC causing the connection to close after executing a COPY command

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group