If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 JDBC Driver bug? Error reading BLOB column.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-17-05, 11:39
joeaggas joeaggas is offline
Registered User
 
Join Date: Jan 2005
Posts: 2
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.
Reply With Quote
  #2 (permalink)  
Old 01-17-05, 13:48
J Petruk J Petruk is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 01-17-05, 14:23
joeaggas joeaggas is offline
Registered User
 
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?
Reply With Quote
  #4 (permalink)  
Old 01-17-05, 14:32
J Petruk J Petruk is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On