Hi, I'm having problem in uploading an image file to the DB2 database. I'm using JDBC2.0. The following is the code:
String sql = ("insert into myblobtable(file_number, uploaded_file) values ("+ fileNumber + ", null)"
String sql1 = ("select * from myblobtable"
try {
poolMgr = PoolManager.getInstance();
System.out.println("DBUtils...poolMgr instantiated"
conn = poolMgr.getConnection();
System.out.println("DBUtils...conn instantiated"
String colName = "Uploaded_File";
stmt = conn.createStatement();
System.out.println("DBUtils...stmt instantiated"
rst = stmt.executeQuery(sql);
rst1 = stmt.executeQuery(sql1);
System.out.println("DBUtils...query executed"
while (rst1.next()){
System.out.println("B4 blob"
Blob blob = rst1.getBlob(colName);
System.out.println("In blob"
}
}
//catch the exception as usual
The message is printed until "B4 blob" only and I received the following error message when I'm trying to call this function.
Root Error-1: COM/ibm/db2/jdbc/app/DB2ResultSet.getBlob
java.lang.AbstractMethodError: COM/ibm/db2/jdbc/app/DB2ResultSet.getBlob at upload.UploadBean.uploadToDb(UploadBean.java:92) at upload.myUploadServlet.processRequest(myUploadServlet.java:46) at upload.myUploadServlet.doPost
Why getBlob() cannot be used? Do you know how to resolve this problem?
Thank you in advance.
String sql = ("insert into myblobtable(file_number, uploaded_file) values ("+ fileNumber + ", null)"
String sql1 = ("select * from myblobtable"
try {
poolMgr = PoolManager.getInstance();
System.out.println("DBUtils...poolMgr instantiated"
conn = poolMgr.getConnection();
System.out.println("DBUtils...conn instantiated"
String colName = "Uploaded_File";
stmt = conn.createStatement();
System.out.println("DBUtils...stmt instantiated"
rst = stmt.executeQuery(sql);
rst1 = stmt.executeQuery(sql1);
System.out.println("DBUtils...query executed"
while (rst1.next()){
System.out.println("B4 blob"
Blob blob = rst1.getBlob(colName);
System.out.println("In blob"
}
}
//catch the exception as usual
The message is printed until "B4 blob" only and I received the following error message when I'm trying to call this function.
Root Error-1: COM/ibm/db2/jdbc/app/DB2ResultSet.getBlob
java.lang.AbstractMethodError: COM/ibm/db2/jdbc/app/DB2ResultSet.getBlob at upload.UploadBean.uploadToDb(UploadBean.java:92) at upload.myUploadServlet.processRequest(myUploadServlet.java:46) at upload.myUploadServlet.doPost
Why getBlob() cannot be used? Do you know how to resolve this problem?
Thank you in advance.