From: | Nicolas Paris <niparisco(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Postgresql - COPY TO - get number row inserted - from JDBC |
Date: | 2015-02-07 17:47:57 |
Message-ID: | CA+ssMOQVMPoaRrHM8ntBpkV7niP3NSADSvDzd0KcN8xPTbijdA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks Adrian and Thomas. I get it worked with CopyIn(sql, inputstream)
method, and then with "FROM STDIN".
If someone interested in ETL Talend software, I actually modified the
component "tPostgresqlBulkExec". You can find it there :
https://github.com/parisni/tPostgresqlBulkExec.git
I guess this is faster to read from STDIN than export the file on the
remote server and then COPY FROM "file exported on the remote server"
isn'it ?
Nicolas PARIS
2015-02-07 16:40 GMT+01:00 Thomas Kellerer <spam_eater(at)gmx(dot)net>:
> Nicolas Paris wrote on 07.02.2015 15:14:
>
> 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 !
>>
>> Nicolas PARIS
>>
>
> I you are using COPY to import a file located on the server, I don't think
> you'll get that information from JDBC.
>
> But you can use the equivalent to "COPY .. FROM stdin" through JDBC.
> And when you do that, you can get the number of rows inserted:
>
> https://jdbc.postgresql.org/documentation/publicapi/org/
> postgresql/copy/CopyManager.html
>
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Jungwirth | 2015-02-07 19:01:48 | Re: How do I bump a row to the front of sort efficiently |
Previous Message | Thomas Kellerer | 2015-02-07 15:40:09 | Re: Postgresql - COPY TO - get number row inserted - from JDBC |