• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Retrieving blob data in java

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

My scenario is : Retrieving the long blob data from mysql database in java and pushing those data into excelsheet.Anybody have idea about this? Please help me.........
 
Sheriff
Posts: 3064
12
Mac IntelliJ IDE Python VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where are you stuck? You get the Blob from your ResultSet, get a binary stream from the Blob, and write the data to a file. You don't have to convert it, do you? I mean, it's already stored in Excel format, right?
 
sutha kavi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Blob data in Db is not in excel format.I read the datas from excel ,validate it and then insert those datas into table. While retrieving , I just get data only(binary format).Also I am using Ibatis.When I used Blob type to retrieve the data, ibatis exception was thrown.how i convert this binary(byte[]) data to string?
 
Greg Charles
Sheriff
Posts: 3064
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, we're making progress. If the binary data isn't in Excel format, what format is it in?

The String class has a constructor that takes a byte array, which converts the bytes to chars using the default character encoding for your platform. That may be all you need.
 
sutha kavi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried for the method that you have told i.e., string constructor with byte array as argument.But the ouput is in binary format only
 
Greg Charles
Sheriff
Posts: 3064
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, let's back up. You get data from a BLOB. You want that data to become an Excel spreadsheet, or possibly a String. However, you don't know, or at least haven't told us, what form that data starts in. You really need to figure that out as your first step.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm still trying to figure out if this question has anything to do with this one: https://coderanch.com/t/541369/Struts/Excel-File-opening
 
reply
    Bookmark Topic Watch Topic
  • New Topic