-->
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.  [ 3 posts ] 
Author Message
 Post subject: Oracle9 and Blob > 4k
PostPosted: Thu Oct 20, 2005 6:34 am 
Newbie

Joined: Thu Mar 31, 2005 4:15 am
Posts: 4
Hibernate version:
2.1.7
Stack trace of any exception that occurs:
java.lang.ClassCastException: oracle.sql.BLOB
Name and version of the database you are using:
Oracle9

I got problem with inserting BLOB > 4k into Oracle database.

Example from http://www.hibernate.org/56.html do not works.

I useTomcata5.5, Hibernate2, Oracle9, Java 1.5.

Did you have the same problem?
Line:
oracle.sql.CLOB clob = (oracle.sql.CLOB) foo.getClob();

throws ClassCastException , why??

Is any other way to insert Blob into Oracle?

Do I have to use some other driver then oracle.thin ?
My context.xml looks like:
Code:
<Resource
     name="jdbc/test"
     auth="Container"
     type="javax.sql.DataSource"
     username="migration"
     password="***"
     driverClassName="oracle.jdbc.driver.OracleDriver"
     url="jdbc:oracle:thin:@123.123.123.123:2222:TEST"
     maxActive="100"
     maxIdle="10"
     maxWait="3000"
   />

Expamle code is:
Code:
  s = sf.openSession();
  tx = s.beginTransaction();
  foo = new Foo();
  foo.setClob( Hibernate.createClob(" ") );
  s.save(foo);
  s.flush();
  s.refresh(foo, LockMode.UPGRADE); //grabs an Oracle CLOB
  oracle.sql.CLOB clob = (oracle.sql.CLOB) foo.getClob();
  java.io.Writer pw = clob.getCharacterOutputStream();
  pw.write(content);
  pw.close();
  tx.commit();
  s.close();


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 7:29 am 
Beginner
Beginner

Joined: Thu Feb 05, 2004 9:09 am
Posts: 27
go to this link http://www.oracle.com/technology/softwa ... index.html
and download oracle jdbc release 2.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 11:19 am 
Newbie

Joined: Thu Mar 31, 2005 4:15 am
Posts: 4
I've try drivers:
ojdbc14.jar
classes12.jar
from version 9.2.0.1.0 and 9.2.0.5
Allways got the same error:
ClassCastException.

... there was one moment when even geting object with Blob was imposible:
Geting object throws somthing about fetch and sequences.
Meybe it was good way ??

Even I try driver version 10.2.0.1.0
Then Ive got error: ORA-12705: Cannot access NLS data files.

If you have any ideas ... please write.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.