-->
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: Connecting Hibernate to Oracle 8
PostPosted: Wed Jan 19, 2005 6:47 am 
Newbie

Joined: Wed Jan 19, 2005 6:30 am
Posts: 3
Good Day!

I fail to configure Hibernate properly to connect it to remote Oracle Server.

Hibernate version:
2.1.7

Code between sessionFactory.openSession() and session.close():
Session session = getSessionFactory().openSession();
Transaction tx = session.beginTransaction(); //exception
tx.commit();
session.close();

Full stack trace of any exception that occurs:
java.lang.UnsupportedOperationException: The user must supply a JDBC connection
at net.sf.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:32)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:289)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3361)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3321)
at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:40)
at net.sf.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:19)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2251)
at rjoker.th1.test.TestApplication1.method5(TestApplication1.java:148)
at rjoker.th1.test.TestApplication1.main(TestApplication1.java:72)

Name and version of the database you are using:
Oracle 8.1.7.4.0

[b]Comments[b]
Without Hibernate there is no problems to connect like this:

DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
DriverManager.getConnection("jdbc:oracle:thin:@oradev:10521:D", "aaa", "bbb");

But with Hibernate I'm getting UnsupportedOperationException with string "The user must supply a JDBC connection" trying to session.beginTransaction() or session.save(...) for example. So real access to the database doesn't work.

Starting Hibernate log contains the following string:
WARN UserSuppliedConnectionProvider:25 - No connection properties specified - the user must supply JDBC connections

If I provide connection manualy everything works:
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
_connection = DriverManager.getConnection("jdbc:oracle:thin:@oradev:10521:D", "aaa", "bbb");
Session session = getSessionFactory().openSession(_connection);
Transaction tx = session.beginTransaction(); //no exception
tx.commit();
session.close();

So, apparently, something wrong with hibernate configuration file.
I'm using hibernate.properties only. I have no hibernate.cfg.xml.

[b]hibernate.properties[b]
hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
hibernate.dialect net.sf.hibernate.dialect.OracleDialect
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
hibernate.connection.username aaa
hibernate.connection.password bbb
hibernate.connection.url jdbc:oracle:thin:@oradev:10521:D
hibernate.connection.pool_size 1
hibernate.proxool.pool_alias pool1
hibernate.jdbc.batch_size 0
hibernate.max_fetch_depth 1
hibernate.jdbc.use_streams_for_binary true
hibernate.jdbc.batch_versioned_data true
hibernate.cache.region_prefix hibernate.test
hibernate.cache.use_query_cache true
hibernate.cache.provider_class net.sf.hibernate.cache.EhCacheProvider

I'm using Java and Hibernate only. There is no containers or frameworks around for the moment. (planning to work with Spring Framework).

I think that due to wrong hibernate.properties Hibernate decides to user UserSuppliedConnectionProvider. But for normal work it shoul choose another ConnectionProvider because all the connection information is included in the hibernate.properties. May be I forgot to set some settings in the hibernate.properties?

Thanks a lot for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 19, 2005 7:04 am 
Newbie

Joined: Wed Jan 19, 2005 6:30 am
Posts: 3
I've just found a solution!
It was my fault in creating SessionFactory.
Thanks a lot!


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.