2
我很抱歉我的英语。我用翻译器。有一个Java代码。从现场Posgresql BYTEA二进制数据,并将其存储在一个文件数据库中读取:如何在xpages中将引用传递给Java中的文件
<code>
public static void saveToFile() throws IOException {
try {
Connection conn = JdbcUtil.getConnection(FacesContext.getCurrentInstance(), "derby1");
ResultSet rs = conn.createStatement().executeQuery(
"SELECT files FROM test_goverment where who='d'");
byte[] imgBytes = null;
if (rs != null) {
while (rs.next()) {
imgBytes = rs.getBytes(1);
}
FileOutputStream os = new FileOutputStream("c:\\samoutput.txt");
os.write(imgBytes);
os.flush();
os.close();
}
rs.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
enter code here}
}
</code>
如何传输的文件下载到用户的XPages。下载后删除它。
非常感谢。有用.... – JohnLemon