Subject | Jaybird RC3 BLOB problems |
---|---|
Author | Andrew Guts |
Post date | 2003-04-25T07:17:13Z |
Hello
Help me please.
The code below works perfect with RC2, but fails with JBird driver RC3.
What is wrong with it?
private InputStream getImg(int id, boolean thumb, Connection conn)
throws SQLException, IOException, BusinessException
{
String sql = "select Picture from pJpegs where WareID = ?";
if (thumb)
sql = "select Thumb from pJpegs where WareID = ? and thumb_width
= "+Integer.toString(width);
PreparedStatement st = conn.prepareStatement(sql);
try {
st.setInt(1, id);
ResultSet rs = st.executeQuery();
if ((rs == null) || !rs.next()) {
log("pJpegs: empty resultset"); // I can see this message in
log file with RC3 driver, not RC2
if (thumb) return null;
else throw new BusinessException("No picture avaliable for
#"+Integer.toString(id));
}
Blob j = rs.getBlob(1);
if (j == null) { log("null blob"); return null; }
return j.getBinaryStream();
}
finally { st.close(); }
}
Thanks
Andrew
Help me please.
The code below works perfect with RC2, but fails with JBird driver RC3.
What is wrong with it?
private InputStream getImg(int id, boolean thumb, Connection conn)
throws SQLException, IOException, BusinessException
{
String sql = "select Picture from pJpegs where WareID = ?";
if (thumb)
sql = "select Thumb from pJpegs where WareID = ? and thumb_width
= "+Integer.toString(width);
PreparedStatement st = conn.prepareStatement(sql);
try {
st.setInt(1, id);
ResultSet rs = st.executeQuery();
if ((rs == null) || !rs.next()) {
log("pJpegs: empty resultset"); // I can see this message in
log file with RC3 driver, not RC2
if (thumb) return null;
else throw new BusinessException("No picture avaliable for
#"+Integer.toString(id));
}
Blob j = rs.getBlob(1);
if (j == null) { log("null blob"); return null; }
return j.getBinaryStream();
}
finally { st.close(); }
}
Thanks
Andrew