|
我用以下代码下载,过程没有报错
但是下载下来的东西 总是86字节,而且打开以后里面总是乱码 这是为什么呢?
请大家帮忙..谢谢了
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@192.168.31.109:1521:iasdb";
//orcl为你的数据库的SID
String user="news";
String password="up722006";
String name="xxx";
Connection conn = DriverManager.getConnection(url,user,password);
PreparedStatement st=conn.prepareStatement("select up_file from test where name=?" );
st.setString(1,name);
//ResultSet rs =st.executeQuery();
ResultSet rs=st.executeQuery();
if (rs.next())
{
byte[] cnt=rs.getBytes("up_file");
System.out.print("here");
response.getOutputStream().write(cnt);
System.out.print("hehe");
}
} |
|