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

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

From: Altaf Malik <mmalik_altaf(at)yahoo(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Dave Cramer <pg(at)fastcrypt(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC causing the connection to close after executing a COPY command
Date: 2007-12-14 11:11:22
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Yes i'll take care of that and send another patch.

Altaf Malik

Kris Jurka <books(at)ejurka(dot)com> wrote: 

On Thu, 13 Dec 2007, Altaf Malik wrote:

> I debugged little more and found that this is not because of incomplete 
> copy support. When a response to any of the copy operations is received, 
> JDBC reads next few bytes to ignore the response. But unfortunately 
> driver reads extra four bytes which is the RFQ message so the RFQ 
> message gets corrupted and IOException is thrown considering it as an 
> unknown packet.

Good catch.

> I am attaching a patch that fixes this issue and driver works smoothly 
> even after giving the error on copy response.

Sort of.  In the case of copying data from the server, if you do have a 
large table, you'll generate a SQLException for every row of the copy 
result which isn't great, but I guess it's better than failing completely. 
Trying to copy out a single column table of 100k integers took about seven 
minutes and 150 MB of memory here.

Also, it doesn't work for copying data to the server.  In that case the 
server is sitting waiting for data and the driver is waiting for the 
server and nothing happens.  That was the case before, so this is no 

Do you have plans to work on this further or shall I apply just this minor 

Kris Jurka

Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

In response to

pgsql-jdbc by date

Next:From: Albert László-RóbertDate: 2007-12-14 11:15:27
Subject: Re: Slow query after upgrades
Previous:From: Kris JurkaDate: 2007-12-14 10:29:10
Subject: Re: how to set a PreparedStatement column of XML type in 8.3?

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