Please help with binary file - Mailing list pgsql-jdbc

From Akash Shah
Subject Please help with binary file
Date
Msg-id 001501c3405c$1ee3f290$8966582b@Akashnew
Whole thread Raw
Responses Re: Please help with binary file
List pgsql-jdbc
Hi ,

I am trying to upload binary file to the PostgreSQL 7.3.2 with JDBC3 driver
supplied by postgresql (pg73jdbc3). The table to which I am trying to save
the file has a field of OID datatype. And while doing so I get

"java.sql.SQLException: ERROR: oidin.............."  error.

I tried changing OID data type to bytea. After that code worked and I tried
file sizes from 4KB to1.6 MB. If file size is larger than that ( even for a
10 MB size file ) execution just gets stuck. No error,  no exception thrown.

My code goes like this...
----------------------------------------------------
//obtained an inputstream handle
InputStream fis=uni.getIstream();

//get size of avialble bytes for read
int c=fis.available();

//unit id is mumeric, content ios of type 'bytea' (postgresql 7.3)
String query = "INSERT INTO elunit (unitid, content)  "+
        "VALUES (nextval('elms_seq_unit'),?)  ";
PreparedStatement ps = con.prepareStatement(query);
ps.setBinaryStream(1, fis, c);
ps.executeUpdate();
--------------------------------------------------------------
the execution just gets stuck at the following line..It does not throw an
exception also......

ps.setBinaryStream(1, fis, c);

I have even tried with the ps.setBytes(byte[]);
Result is just the same....

Please let meknow if I have missed out something or something is wrong with
the code.

Thanks,
Akash



pgsql-jdbc by date:

Previous
From: "Patric Bechtel"
Date:
Subject: Re: db [Viruschecked]
Next
From: Paul Thomas
Date:
Subject: Re: Please help with binary file