Re: Postgresql - COPY TO - get number row inserted - from JDBC

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Nicolas Paris <niparisco(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Postgresql - COPY TO - get number row inserted - from JDBC
Date: 2015-02-07 15:20:33
Message-ID: 54D62D41.2070102@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/07/2015 06:14 AM, Nicolas Paris wrote:
> Hello !
>
> My goal is to get the result from "COPY TO ..." query, from JDBC. This
> query returns : COPY X
> (where X is number line inserted)
> 1) Can I can I consider it useless, since when no error, all lines are
> suposed to be inserted ?
> 2) If not useless, how can I get the response "COPY 10" (when 10 rows
> inserted), I get with psql way, or with pgadmin.
>
> I have tried the int Statement.executeUpdate() method, but it returns 0
>
> Thanks for any help !

I am not a Java programmer, but I think what you want is here:

https://jdbc.postgresql.org/documentation/publicapi/index.html

under org.postgresql.copy

>
> Nicolas PARIS

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2015-02-07 15:40:09 Re: Postgresql - COPY TO - get number row inserted - from JDBC
Previous Message Nicolas Paris 2015-02-07 14:14:11 Postgresql - COPY TO - get number row inserted - from JDBC