Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Retrieving BLOB objects from DB2 database

 
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!
 
author & internet detective
Posts: 39986
806
Eclipse IDE VI Editor Java
  • 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
Posts: 39986
806
Eclipse IDE VI Editor Java
  • 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
Posts: 39986
806
Eclipse IDE VI Editor Java
  • 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!
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic