PGCopyOutputStream Doesn't Hold Connection - Mailing list pgsql-jdbc

From Michael Daines
Subject PGCopyOutputStream Doesn't Hold Connection
Date
Msg-id 461eb8dc-0a13-42c1-a84e-8a6545b0c58d@googlegroups.com
Whole thread Raw
List pgsql-jdbc
Something that might be worth noting (in documentation?) is that the PGCopyOutputStream class doesn't hold a reference
toits Connection. 

We came across this because we were trying to keep our DB code separate from the logic, and we started getting errors
writingto the PGCopyOutputStream. We banged our heads against it for a while before realizing that the Connection was
gettinggarbage collected while we were still writing to it. 

Our solution was to extend PGCopyOutputStream and hold on to the Connection in that child class, also giving it
responsibilityfor closing it. 

I'm not sure I would call this a defect, but it is something I wanted to share with other people, since we couldn't
findanything in our searches on the problem while we were having it. 


pgsql-jdbc by date:

Previous
From: "David Johnston"
Date:
Subject: Re: Parameters are not being setted in a copy statement
Next
From: Sérgio Saquetim
Date:
Subject: Re: Severe performance degradation when using the 9.2-1000 JDBC 4 driver