Re: BLOB question
From: <susantha222_at_my-deja.com>
Date: 2000/05/02
Message-ID: <8elbp9$iu0$1_at_nnrp1.deja.com>#1/1
Date: 2000/05/02
Message-ID: <8elbp9$iu0$1_at_nnrp1.deja.com>#1/1
Vincent,
I think the following code will be helpful to update/insert data to a blob field. Here I used the SQL Server. I think it will be the same for Oracle.
/* following readStreamFromFile returns the content of a random access file (aImageFile) as bytes. con - connection */ byte[] aLogoInBytes = readStreamFromFile(aImageFile); PreparedStatement aprepstmt = con.prepareStatement ("UPDATE pub_info SET logo = ? WHERE pub_id='0736'"); ByteArrayInputStream abais = new ByteArrayInputStream(aLogoInBytes);
aprepstmt.setBinaryStream(1,abais, aLogoInBytes.length); aprepstmt.executeUpdate(); con.commit();
Good luck!
Susantha.
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue May 02 2000 - 00:00:00 CEST