On Wed, Feb 11, 2009 at 11:22 AM, SHARMILA JOTHIRAJAH
<sharmi_jo@yahoo.com> wrote:
> Hi,
> A question about the Postgresql's COPY command.
>
> This is the syntax of this command from the manual
>
> COPY tablename [ ( column [, ...] ) ]
> FROM { 'filename' | STDIN }
> [ [ WITH ]
> .....
> I want to migrate my tables from Oracle to Postgres.
> The COPY FROM command can take input from 'file' or 'STDIN'.
> Is it possible for the COPY command to take its input from a
> java program(which contains the oracle resultset) or any other way?
If that java program can provide direct input to postgresql then yes.
If everything has to be a prepared statement etc then no. Assuming
your java framework allows you just throw input at the database, you'd
be able to just give it the input line by line.
> I know I could get the Oracle rows in a csv format but
> Im trying to get it done without any file in between ?
>
> In short is it possible to use this 'COPY' command to migrate my tables'
> data from Oracle to Postgresql without using any file
> in between?
Sure, I can do it in PHP. I've done it in PHP. If your java
connectors have the facility to throw raw sql at pgsql then it should
work.