File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC - BLOB question for Java gurus

 
sanz nsgha
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I have created a table tblRead in Access 2000 with only 1 field:
Field name: Notes
Field type: OLE Object (BLOB equivalent in Access)
2. I have a Java app - something like this:
ResultSet rs = stmt.executeQuery("select Notes from tblRead");
Blob data = rs.getBlob("Notes");
java.io.InputStream in = data.getBinaryStream();
int i;
while ((in.read()) > -1) {
i = in.read();
System.out.println(i);
}
Compiles fine. But gives exception: java.lang.UnsupportedOperationException.
Anybody, any idea where it went wrong?
Thanks
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sanjay
When I use the Blob datatype I use this code:

The class ObjectConverter has two methods, one of them is toObject:

/Ren�
 
sanz nsgha
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rene, thanks a lot of your answer.
Debugging shows that an exception occurs at:
Blob readBlob = rs.getBlob(1);
So I am wondering if the problem is non-compatibility of JDBC "Blob" type and Microsoft Access "OLE OBject" type. Have you tried the code with MS Access OLE Object?
Thanks again
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
No I have not.
Maybe you can use:
Object obj = rs.getObject(1);
and then caste obj to an OLE Object??
/Ren�
 
sanz nsgha
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rene. What would be the compatible type in MS Access 2000 for Java/JDBC Blob type?
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to post this message in the JDBC forum, as it has no bearing on the SCJD exam.
Mark
 
sanz nsgha
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mark, i don't think so. as a developer preparing for developer exam, we should be able to analyze and troubleshoot such problems.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mark, i don't think so. as a developer preparing for developer exam, we should be able to analyze and troubleshoot such problems.

What part of the assignment is about JDBC or Access. Nothing, therefore you are wrong. You also posted this in the SCWCD Exam, now again JDBC and Access has nothing to do with the Web Component Cert. Your question only fits into the JDBC Forum, and maybe EJB, if you are creating a BMP Entity bean.
Plus, you are not even taking the SCJD exam currently, this is your only post you have ever posted here in the SCJD forum.
[ April 01, 2002: Message edited by: Mark Spritzler ]
[ April 01, 2002: Message edited by: Mark Spritzler ]
 
Bal Sharma
Ranch Hand
Posts: 273
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Mark!
-Bal
 
sanz nsgha
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java developers or a bunch of policemen? huh
 
Bal Sharma
Ranch Hand
Posts: 273
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sanjay amatya:
Java developers or a bunch of policemen? huh

I wish you had understood the sprit of Developer forum. We share knowdlege on how to solve the SCJD assignment. Alas, If you had downloaded assignment, I am pretty sure you would not had asked JDBC question here. There is separate JDBC forum in JAVARANCH too.
Anyway, thanks for your kindness labeling a bunch of policemen for helping hands.
-Bal
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could a Sheriff or Bartender either lock this thread or delete it. It doesn't belong here.
Thanks
Mark
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic