create table tb_file(name varchar(20),detail long raw);
然后
File file = new File("aaa.gif");
int fileLength =(int) file.length();
InputStream fin = new FileInputStream(file);
PreparedStatement pstmt = con.prepareStatement("insert into tb_file
values('aaa.gif',?)");
pstmt.setBinaryStream (1, fin, fileLength);
pstmt.executeUpdate();
同样读取数据LONG RAW那样
InputStream in = rs.getBinaryInputStream("detail");