File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Retrieving BLOB objects from DB2 database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Retrieving BLOB objects from DB2 database" Watch "Retrieving BLOB objects from DB2 database" New topic
Author

Retrieving BLOB objects from DB2 database

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hi there. I have written an app that reads a result set that contains a BLOB object. I have two different questions:

1). Is there anyway that I can automatically determine the file extension of the BLOB object in the database?

2). When I run the java app, it takes a VERY long time for the app to read the BLOB object(s). Can you look at the following code and tell me if I'm doing something wrong?




Thanks for any help!
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

1) No. If you need this info, you would have to store it in a separate field before you store the file.

2) How long does it take? How big is the file?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Thanks for the reply! The file that I am storing in my table (which is defined as BLOB(5M)) is a .pdf that is only 116K....... it takes about 50 seconds for the information to come up on the screen...... the line of code that seems to be taking a long time is when I call the getBinaryStream() method. Any ideas?
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Something else that is also really weird is once the attachment finally shows up in the JTextPane area (as a JButton), the JButton component (Jbutton) is constantly shaking (looks like it is rapidly bouncing up and down)....... anyone ever experienced this behavior before?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Jennifer Sohl wrote:Something else that is also really weird is once the attachment finally shows up in the JTextPane area (as a JButton), the JButton component (Jbutton) is constantly shaking (looks like it is rapidly bouncing up and down)....... anyone ever experienced this behavior before?

That sounds like a Swing question. You might want to post it in the Swing forum.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Jennifer Sohl wrote:Thanks for the reply! The file that I am storing in my table (which is defined as BLOB(5M)) is a .pdf that is only 116K....... it takes about 50 seconds for the information to come up on the screen...... the line of code that seems to be taking a long time is when I call the getBinaryStream() method. Any ideas?

Is your database on a remote machine? How long does it normally take to download a PDF that size? If you have a dial-up type connection, that sounds about normal.
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hi there! Just wanted to let you know..... I did some more poking around and believe I have resolved the issue....... instead of grabbing the BLOB using InputStream.... I used BufferedInputStream and it popped up lickety split! Thank you so much for all of your help!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieving BLOB objects from DB2 database