From: | "Akash Shah" <akash(dot)s(at)ap(dot)sony(dot)com> |
---|---|
To: | <pgsql-jdbc(at)postgresql(dot)org> |
Cc: | <pgsql-jdbc-owner(at)postgresql(dot)org> |
Subject: | Please help with binary file |
Date: | 2003-07-02 05:38:09 |
Message-ID: | 001501c3405c$1ee3f290$8966582b@Akashnew |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Patric Bechtel | 2003-07-02 08:51:49 | Re: db [Viruschecked] |
Previous Message | Barry Lind | 2003-07-02 01:27:50 | Re: New patches |