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