Forums Register Login

JDBC3 - How to write in bytea

+Pie Number of slices to send: Send
Hi,
I used JDBC3 driver for inserting into postgresql 7.3. The field's datatype is bytea. When i tried to insert more than 2MB file, it is hanging. Can somebody give me the full working code for inserting bigger files like 40MB into bytea?
Thanks in advance,
Sankar
+Pie Number of slices to send: Send
Hi All,
I am placing the code here :
UnitForm uni - javabean
InputStream fstream=null;
fstream=uni.getIstream();
int c=fstream.available();
String query = "INSERT INTO elunit (unitid, domainid, unitname, unittype, "+
"description, content_type, filename, content) "+
"VALUES (nextval('elms_seq_unit'),?,?,?,?,?,?,?) ";
ps = con.prepareStatement(query);
ps.setInt(1,Integer.parseInt(uni.getDomainid()));
ps.setString(2,uni.getUnitname());
ps.setString(3,uni.getUnittype());
ps.setString(4,uni.getDescription());
ps.setString(5,uni.getContenttype());
ps.setString(6,uni.getFilename());
ps.setBinaryStream(7, fstream, c);
ps.executeUpdate();
ps.close();

Pleaze help,
Sankar
Space pants. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1092 times.
Similar Threads
Images using Ajax
Query returs empty list but getting results in TOAD
Convertion form BYTEA to STRING
Issue while retrieving BLOB from ORACLE 9i, using Hibernate 3.0
Retrieving blob object from postgres database
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 05:51:33.