• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieving BLOB objects from DB2 database

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34669
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34669
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34669
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic