利用ResultSet的方法
public InputStream getBinaryStream(String columnName)
获得InputStream
再通过字节数组
byte[] byteArray = new byte[8092]
一部分一部分写入FileOutputStream中
public InputStream getBinaryStream(String columnName)
获得InputStream
再通过字节数组
byte[] byteArray = new byte[8092]
一部分一部分写入FileOutputStream中
int len;
InputStream is = rs.getBinaryStream("File_Bit");
FileOutputStream f = new FileOutputStream("imagename.jpg");
len = is.read(byteArray);
while (len != -1)
{
f.write(byteArray, 0, len);
len = is.read(byteArray);
}
f.close();
能告诉下是怎么调用上的吗?其中的数据源是怎么配置的以及在java中该选用什么驱动程序???
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String s = "jdbc:odbc:test";
Connection con = DriverManager.getConnection(s,"sa","88888");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);