如何将byte存入ORACLE数据库
1个回答
展开全部
以java代码为例:
try{
conn = this.getConnection();
conn.setAutoCommit(false);
java.sql.Statement st = conn.createStatement();
String sql1 = "insert into test_image(test_id,image) values ("123",empty_blob())";
System.out.println("--------->"+sql1);
String stl2 = "select image from test_image where test_id='"+test.getId()+"' for update";
ResultSet rs = st.executeQuery(stl2);
OutputStream outStream = null;
if (rs.next())
{
oracle.sql.BLOB blob = (oracle.sql.BLOB) rs.getBlob("image");
outStream = blob.getBinaryOutputStream();
outStream.write(byte[],0, byte[].length);
}
outStream.flush();
outStream.close();
conn.commit();
conn.close();
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询