psql COPY with JDBC

Lists: pgsql-jdbc
From: "Christopher Condit" <condit(at)sdsc(dot)edu>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: psql COPY with JDBC
Date: 2006-04-03 20:36:52
Message-ID: 845AADAC1106E44996327D62097E4C6B8AA6BC@et.ad.sdsc.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hi All-

I've been trying over at the general postgres list with no luck, so I
thought I'd try here. I need to bulk load results from a Java
application on one machine to a postgres db on a remote server. I know
I can use psql interactively to accomplish this, but I'd like to be able
to do it programmatically:

1) I noticed that there was a COPY patch floating around a couple
of years ago - does this still exist. If so, has it been updated for
the latest JDBC driver?

2) Is there a better way to accomplish this than the above patch -
with or without JDBC?

Thanks for your time!

Chris


From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Christopher Condit <condit(at)sdsc(dot)edu>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: psql COPY with JDBC
Date: 2006-04-03 23:04:08
Message-ID: 36891C5A-13CC-49C8-AF27-E212A253E97A@fastcrypt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Yeah, there is a patch, this is rather old now but will do copy.

http://download.postgresintl.com/copy.tar.gz

Dave
On 3-Apr-06, at 4:36 PM, Christopher Condit wrote:

> Hi All-
>
> I’ve been trying over at the general postgres list with no luck, so
> I thought I’d try here. I need to bulk load results from a Java
> application on one machine to a postgres db on a remote server. I
> know I can use psql interactively to accomplish this, but I’d like
> to be able to do it programmatically:
>
> 1) I noticed that there was a COPY patch floating around a
> couple of years ago – does this still exist. If so, has it been
> updated for the latest JDBC driver?
>
> 2) Is there a better way to accomplish this than the above
> patch – with or without JDBC?
>
>
>
> Thanks for your time!
>
>
>
> Chris
>
>


From: Markus Schaber <schabi(at)logix-tt(dot)com>
To: Christopher Condit <condit(at)sdsc(dot)edu>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: psql COPY with JDBC
Date: 2006-04-04 16:21:06
Message-ID: 44329CF2.6010204@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hi, Christopher,

Christopher Condit wrote:

> I’ve been trying over at the general postgres list with no luck, so I
> thought I’d try here. I need to bulk load results from a Java
> application on one machine to a postgres db on a remote server. I know
> I can use psql interactively to accomplish this, but I’d like to be able
> to do it programmatically:

Some ideas for "ugly hacks":

- Use a java.lang.ProcessBuilder and pipe into psql

- Use some secure channel (e. G. libjsch or https upload) to copy the
date into a file on the server, and then issue "COPY table FROM file".

HTH,
Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org