Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2005
    Posts
    2

    Unanswered: DB2 JDBC Driver bug? Error reading BLOB column.

    Hi,
    Currently this is the situation. I am running a set of code that accesses (DB2 8.1 on WinXP) a table that stores file contents. The function is able to successfully insert a file into the record. However, I am unable to retrieve the BLOB contents during select.

    Here is the insert
    [1/18/05 0:31:47:031 SGT] 68c228e2 SystemOut O DSCN0389s2.JPG
    [1/18/05 0:31:47:031 SGT] 68c228e2 SystemOut O image/pjpeg
    [1/18/05 0:31:47:031 SGT] 68c228e2 SystemOut O wpsadmin
    [1/18/05 0:31:47:031 SGT] 68c228e2 SystemOut O java.io.FileInputStream@2a3828f7
    [1/18/05 0:31:47:031 SGT] 68c228e2 SystemOut O 1105979507031
    [1/18/05 0:31:48:293 SGT] 68c228e2 SystemOut O File content inserted successfully. Row count = 1

    Here is select.
    [1/18/05 0:32:52:655 SGT] 329168f8 WebGroup I SRVE0180I: [PFSPortletApplication] [/.pfs] [Servlet.LOG]: DownloadFileServlet: init
    [1/18/05 0:32:53:526 SGT] 329168f8 WebGroup E SRVE0026E: [Servlet Error]-[SQLGetByteArray]: java.lang.UnsatisfiedLinkError: SQLGetByteArray
    at COM.ibm.db2.jdbc.app.DB2Blob.getBytes(DB2Blob.java :306)
    at pmo.syabas.ibm.psf.databean.FileManagementService. getAFile(FileManagementService.java:226)
    at pmo.syabas.ibm.psf.servlet.helper.DownloadFileServ let.doPost(DownloadFileServlet.java:35)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)




    Code snippet;
    if (dbconn != null) {
    sql0 = "select fsfid, fsfname, fsftype, fsfowner, fsfcontent, fsfdate, fsfsize from " + DBConnectionService.dbSchema + "PFSFILE where FSFID=?";

    pstmt = dbconn.prepareStatement(sql0);
    pstmt.setInt(1, p_fileID);
    rs = pstmt.executeQuery();
    if (rs.next()) {

    lc_aFile = new PFSFile();
    lc_aFile.setFileUID(rs.getInt("fsfid"));
    lc_aFile.setFileName(rs.getString("fsfname"));
    lc_aFile.setFileType(rs.getString("fsftype"));
    lc_aFile.setFileOwnerID(rs.getString("fsfowner"));
    bl = rs.getBlob("fsfcontent");
    blobSize = rs.getInt("fsfsize");
    lc_aFile.setBlobReadOut(bl.getBytes(1, blobSize)); // Died at getBytes.
    lc_aFile.setFileDate(rs.getDate("fsfdate"));
    lc_aFile.setFileTime(rs.getTime("fsfdate"));
    lc_aFile.setFileSize(blobSize);

    } // end If (rs.next())

    } // End If


    Some how I don't seem to understand why the following error occured only in WSAD Test environment. I am currently pleading to anyone who has encounter or solve such a problem for their technical advices.

    I will gladly supply more information is necessary. Thank you in advance.

  2. #2
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    That means the JVM can't find a library that a native method requires... are you using the Type 2 driver?

    Try the Type 4 driver if you're on v8, it's the recommended driver now.

    http://www-106.ibm.com/developerwork...ikopoulos.html
    --
    Jonathan Petruk
    DB2 Database Consultant

  3. #3
    Join Date
    Jan 2005
    Posts
    2

    Talking JDBC Driver Bug?

    Yes, I am using type 2. It was working awhile back but only recently this error surfaced. Let me give it a try on Type4.
    However, I wonder what sort of native library (dll, so) that I need to support this method? "bl.getBytes(1, blobSize)". Do u know?

  4. #4
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Quote Originally Posted by joeaggas
    Yes, I am using type 2. It was working awhile back but only recently this error surfaced. Let me give it a try on Type4.
    However, I wonder what sort of native library (dll, so) that I need to support this method? "bl.getBytes(1, blobSize)". Do u know?
    I assume it's something in sqllib\bin but I'm not certain.
    --
    Jonathan Petruk
    DB2 Database Consultant

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •