0
我有一個hsqldb數據庫打包在一個包含我的數據庫文件(mydb.script和mydb.lobs)的jar文件中。帶有「res」連接字符串的hsqldb中的Blob
當使用「res」url(jdbc:hsqldb:res:mydb)連接到我的數據庫時,除了從BLOB列中獲取字節外,所有查詢都可以正常工作。這是例外,我得到:
Caused by: org.hsqldb.HsqlException: file input/output error
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.types.BlobDataID.getBytes(Unknown Source)
at org.hsqldb.types.BlobInputStream.readIntoBuffer(Unknown Source)
當連接到同一個數據庫中使用「文件」 URL一切正常。用來從BLOB列字節的代碼是這樣的:
// rs is ResultSet
Blob blob = rs.getBlob(i + 1);
int blobSize = (int) blob.length();
byte[] bytes = new byte[blobSize];
InputStream is = blob.getBinaryStream();
try {
is.read(bytes, 0, blobSize);
} catch (IOException e) {
logger.error("Error reading bytes from blob: ", e);
}
任何想法可能會導致從BLOB列讀取字節失敗使用「資源」的網址時,併成功使用「文件」網址是什麼時候?
快照與LOB支持,現在可 – fredt
那是快,工作太棒了!謝謝! – ivans