日期:2014-05-19 浏览次数:20885 次
InputStream is = 类名.class.getResourceAsStream("/xxx.yyy");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] b = new byte[1024];
int h;
while((h = is.read(b, 0, b.length)) != -1) {
baos.write(b, 0, h);
}
// 链接数据库的代码省略..............
PreparedSteatement pstmt = conn.preparedStatement("insert into tablename (xxx) values (?)");
pstmt.setBytes(1, baos.toByteArray());
pstmt.executeUpdate();
.........................
pstmt.set