this.strSQL="select * from dealer_image order by id desc";
rs=stmt.executeQuery(this.strSQL);
int id=0;
if(rs.next()){
id=rs.getInt("ID");
}
id=id+1;
this.strSQL="insert into dealer_image(ID,NAME,AGE,TIME,JPGIMAGE,STATUS) values(SEQ_DEALER.Nextval,'"+userid+"','"+userag+"',"+"sysdate,empty_blob(),0)";
stmt.executeUpdate(this.strSQL);
conn.setAutoCommit(false);
rs = stmt.executeQuery("select JPGIMAGE from dealer_image where id="+id+" for update");
if (rs.next())
{
Blob blob = rs.getBlob(1);
OutputStream out = ((oracle.sql.BLOB) blob).getBinaryOutputStream();
// OutputStream out = rs.getBlob(1).setBinaryStream(1L);
byte[] b = new byte[((oracle.sql.BLOB) blob).getBufferSize()];
InputStream fin = new FileInputStream("c:\\xxx.jpg");
int len = 0;
while ((len = fin.read(b)) != -1) {
}
out.write(b, 0, len);
fin.close();
out.close();
conn.setAutoCommit(true);
conn.commit();