-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: inserting blobs into oracle DB
PostPosted: Fri Apr 26, 2013 4:48 am 
Newbie

Joined: Wed Mar 06, 2013 8:29 am
Posts: 3
Hi, attempting to insert a blob into an oracle database (tried 10g and 11g), and tried ojdbc5 & 6 with both databases too but keep getting the following error when posting:

Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.OraclePreparedStatementWrapper.setBinaryStream(ILjava/io/InputStream;J)V

column is of type java.sql.blob.

using:

File file = new File("D:\\test.txt");
byte[] bFile = new byte[(int) file.length()];
FileInputStream fileInputStream = new FileInputStream(file);
fileInputStream.read(bFile);
fileInputStream.close();
con.setDocument(Hibernate.getLobCreator(session).createBlob(bFile));
session.save(con); //throws above hibernate error.

Has anyone else come across this issue, or any tips?

Cheers,

Tim.


Top
 Profile  
 
 Post subject: Re: inserting blobs into oracle DB
PostPosted: Wed May 08, 2013 3:48 am 
Newbie

Joined: Wed Mar 13, 2013 11:32 am
Posts: 16
Hi

I think you need to update you oracle JDBC driver to match 10g and 11g

You do not write how you map you entity class

If you are using annotation you should be able to map it somthing like this

class Con {

...
...
@Lob
@Column(name="document")
private byte[] document;

...
...
}

in your code you can to this:

File file = new File("D:\\test.txt");
byte[] bFile = new byte[(int) file.length()];
FileInputStream fileInputStream = new FileInputStream(file);
fileInputStream.read(bFile);
fileInputStream.close();
con.setDocument(bFile);
session.save(con);


Br

Jesper


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.