-->
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.  [ 12 posts ] 
Author Message
 Post subject: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Wed Apr 18, 2012 10:57 am 
Newbie

Joined: Wed Apr 18, 2012 10:50 am
Posts: 8
Bonjour
je suis newbie alors j'ai besoin vos aides svp

j'ai eu le message d'erreur suivant quand j'essaie de me connecter à la base Oracle en utilisant hibernate

WARN: HHH000342: Could not obtain connection to query metadata : No suitable driver found for jdbc:oracle:thin:@x.y.z.t:1521:mySI

....

ERROR: HHH000231: Schema export unsuccessful
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@x.y.z.t:1521:mySI

Oracle 9.0.2.0.0
jodbc ojdbc14.jar
jdk1.6.0_29

hibernate.cfg.xml:
...
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@x.y.z.t:1521:mySI</property>
<property name="hibernate.connection.username">USERNAME</property>
<property name="hibernate.connection.password">PASSWORD</property>

<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
...

d'avance merci
cordialement
ndhai


Last edited by ndhai on Wed Apr 18, 2012 1:32 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracl
PostPosted: Wed Apr 18, 2012 12:13 pm 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
what version of hibernate?


Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Wed Apr 18, 2012 1:32 pm 
Newbie

Joined: Wed Apr 18, 2012 10:50 am
Posts: 8
4.1.2.Final

I am on the example http://docs.jboss.org/hibernate/orm/4.1 ... index.html
(sources codes here http://docs.jboss.org/hibernate/orm/4.1 ... orials.zip)

it worked with H2 in-memory database but not with my database Oracle :(
thanks


Last edited by ndhai on Thu Apr 19, 2012 2:45 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Thu Apr 19, 2012 2:44 am 
Newbie

Joined: Wed Apr 18, 2012 10:50 am
Posts: 8
hi everybody
sorry, I wrote in french in first post

--------------------

Bonjour
I'm newbie then I need your helps please

I got message error following when I try to connect to database Oracle by using hibernate 4.1.2.Final

WARN: HHH000342: Could not obtain connection to query metadata : No suitable driver found for jdbc:oracle:thin:@x.y.z.t:1521:mySI

....

ERROR: HHH000231: Schema export unsuccessful
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@x.y.z.t:1521:mySI

Oracle 9.0.2.0.0
jodbc ojdbc14.jar
jdk1.6.0_29

hibernate.cfg.xml:
...
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@x.y.z.t:1521:mySI</property>
<property name="hibernate.connection.username">USERNAME</property>
<property name="hibernate.connection.password">PASSWORD</property>

<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
...

for information: I can connect to this database by using java lib, with the same information (driver, url, user, password)
Code:
Class.forName(driver);
Connection m_Connection = DriverManager.getConnection(url,user,password);


thanks a lot
best regards
ndhai


Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Thu Apr 19, 2012 3:24 am 
Newbie

Joined: Wed Apr 18, 2012 10:50 am
Posts: 8
I wonder if this pb is talked about here viewtopic.php?f=1&t=1015136 (not with oracle)
I will try to downgrade to 4.1.1


Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Thu Apr 19, 2012 4:57 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Looks suspiciously like the same problem I'm having...

You could try making a direct call to load the driver before initialising Hibernate:
try {
Class.forName("oracle.jdbc.driver.OracleDriver");

} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}

db


Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Thu Apr 19, 2012 5:28 am 
Newbie

Joined: Wed Apr 18, 2012 10:50 am
Posts: 8
yes, I had ready tried but nothing is changed!
(I had tried with 4.1.1 but IT DID NOT WORK :( !)

Code:
   public void testBasicUsage() {
      System.out.println("testConnect by Java...");
      String driver =  "oracle.jdbc.driver.OracleDriver";
      String url = "jdbc:oracle:thin:@z.y.z.t:1521:mySI";
      String user = "USER";
      String password = "PASSWORD";

      try {
         Class.forName(driver);
         Connection conn = DriverManager.getConnection(url,user,password);
         DatabaseMetaData meta = conn.getMetaData();
         System.out.println("RDBMS: " + meta.getDatabaseProductName() + ", version: " + meta.getDatabaseProductVersion() );
         System.out.println("JDBC driver: " + meta.getDriverName() + ", version: " + meta.getDriverVersion() );
         System.out.println("conn by JAVA OK");

         // create a couple of events...
         Session session = sessionFactory.openSession();
         session.beginTransaction();
         session.save(new Event("Our very first event!", new Date()));
         session.save(new Event("A follow up event", new Date()));
         session.getTransaction().commit();
         session.close();

         // now lets pull events from the database and list them
         session = sessionFactory.openSession();
         session.beginTransaction();
         List result = session.createQuery("from Event").list();
         for (Event event : (List<Event>) result) {
            System.out.println("Event (" + event.getDate() + ") : "
                  + event.getTitle());
         }
         session.getTransaction().commit();
         session.close();

      } catch (ClassNotFoundException ex) {
         ex.printStackTrace();
      } catch (Exception e) {
         e.printStackTrace();
      }
   }


traces output

Code:
19 avr. 2012 11:22:22 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
19 avr. 2012 11:22:22 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.2.Final}
19 avr. 2012 11:22:22 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
19 avr. 2012 11:22:22 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
19 avr. 2012 11:22:22 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
19 avr. 2012 11:22:22 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
19 avr. 2012 11:22:22 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org/hibernate/tutorial/hbm/Event.hbm.xml
19 avr. 2012 11:22:22 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
19 avr. 2012 11:22:22 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
19 avr. 2012 11:22:22 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 1
19 avr. 2012 11:22:22 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
19 avr. 2012 11:22:22 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@x.y.z.t:1521:mySI]
19 avr. 2012 11:22:22 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=USER, password=****}
19 avr. 2012 11:22:22 org.hibernate.engine.jdbc.internal.JdbcServicesImpl configure
WARN: HHH000342: Could not obtain connection to query metadata : No suitable driver found for jdbc:oracle:thin:@x.y.z.t:1521:mySI
19 avr. 2012 11:22:22 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle9iDialect
19 avr. 2012 11:22:22 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000422: Disabling contextual LOB creation as connection was null
19 avr. 2012 11:22:22 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
19 avr. 2012 11:22:22 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
19 avr. 2012 11:22:22 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000227: Running hbm2ddl schema export
19 avr. 2012 11:22:22 org.hibernate.tool.hbm2ddl.SchemaExport execute
ERROR: HHH000231: Schema export unsuccessful
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@x.y.z.t:1521:mySI
   at java.sql.DriverManager.getConnection(DriverManager.java:602)
   at java.sql.DriverManager.getConnection(DriverManager.java:154)
   at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:192)
   at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
   at org.hibernate.tool.hbm2ddl.DatabaseExporter.<init>(DatabaseExporter.java:52)
   at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:367)
   at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:304)
   at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:293)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1741)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1779)
   at org.hibernate.tutorial.hbm.NativeApiIllustrationTest.setUp(NativeApiIllustrationTest.java:52)
   at junit.framework.TestCase.runBare(TestCase.java:132)
   at junit.framework.TestResult$1.protect(TestResult.java:110)
   at junit.framework.TestResult.runProtected(TestResult.java:128)
   at junit.framework.TestResult.run(TestResult.java:113)
   at junit.framework.TestCase.run(TestCase.java:124)
   at junit.framework.TestSuite.runTest(TestSuite.java:243)
   at junit.framework.TestSuite.run(TestSuite.java:238)
   at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
19 avr. 2012 11:22:22 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000230: Schema export complete
testConnect by Java...
RDBMS: Oracle, version: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
JDBC driver: Oracle JDBC driver, version: 9.2.0.8.0
conn by JAVA OK
Hibernate: select max(EVENT_ID) from EVENTS
19 avr. 2012 11:22:26 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 942, SQLState: 42000
19 avr. 2012 11:22:26 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: ORA-00942: Table ou vue inexistante

org.hibernate.exception.SQLGrammarException: ORA-00942: Table ou vue inexistante

   at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:122)
   at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
   at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
   at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
   at $Proxy5.executeQuery(Unknown Source)
   at org.hibernate.id.IncrementGenerator.initializePreviousValueHolder(IncrementGenerator.java:128)
   at org.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:68)
   at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:118)
   at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:204)
   at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:55)
   at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:189)
   at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:49)
   at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
   at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:724)
   at org.hibernate.internal.SessionImpl.save(SessionImpl.java:716)
   at org.hibernate.internal.SessionImpl.save(SessionImpl.java:712)
   at org.hibernate.tutorial.hbm.NativeApiIllustrationTest.testBasicUsage(NativeApiIllustrationTest.java:78)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at junit.framework.TestCase.runTest(TestCase.java:168)
   at junit.framework.TestCase.runBare(TestCase.java:134)
   at junit.framework.TestResult$1.protect(TestResult.java:110)
   at junit.framework.TestResult.runProtected(TestResult.java:128)
   at junit.framework.TestResult.run(TestResult.java:113)
   at junit.framework.TestCase.run(TestCase.java:124)
   at junit.framework.TestSuite.runTest(TestSuite.java:243)
   at junit.framework.TestSuite.run(TestSuite.java:238)
   at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.sql.SQLException: ORA-00942: Table ou vue inexistante

   at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
   at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
   at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:590)
   at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1973)
   at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:850)
   at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2599)
   at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2963)
   at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
   at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:584)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
   ... 33 more
testBasicUsage...
19 avr. 2012 11:22:26 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
INFO: HHH000030: Cleaning up connection pool [jdbc:oracle:thin:@x.y.z.t:1521:mySI]



any idea?
thanks a lot
ndhai


Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Thu Apr 19, 2012 5:54 am 
Newbie

Joined: Wed Apr 18, 2012 10:50 am
Posts: 8
with 4.1.1.Final, the traces are differents

Console
Code:
19 avr. 2012 11:38:36 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
19 avr. 2012 11:38:36 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.1}
19 avr. 2012 11:38:36 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
19 avr. 2012 11:38:36 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
19 avr. 2012 11:38:36 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
19 avr. 2012 11:38:36 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
19 avr. 2012 11:38:36 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org/hibernate/tutorial/hbm/Event.hbm.xml
19 avr. 2012 11:38:37 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
19 avr. 2012 11:38:37 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
19 avr. 2012 11:38:37 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 1
19 avr. 2012 11:38:37 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
19 avr. 2012 11:38:37 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@x.y.z.t:1521:mySI]
19 avr. 2012 11:38:37 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=USER, password=****}


JUnit Errors
Code:
java.lang.AbstractMethodError: oracle.jdbc.driver.OracleDatabaseMetaData.locatorsUpdateCopy()Z
   at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:143)
   at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
   at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2273)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2269)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1738)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1778)
   at org.hibernate.tutorial.hbm.NativeApiIllustrationTest.setUp(NativeApiIllustrationTest.java:52)
   at junit.framework.TestCase.runBare(TestCase.java:132)
   at junit.framework.TestResult$1.protect(TestResult.java:110)
   at junit.framework.TestResult.runProtected(TestResult.java:128)
   at junit.framework.TestResult.run(TestResult.java:113)
   at junit.framework.TestCase.run(TestCase.java:124)
   at junit.framework.TestSuite.runTest(TestSuite.java:243)
   at junit.framework.TestSuite.run(TestSuite.java:238)
   at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Thu Apr 19, 2012 6:09 am 
Newbie

Joined: Wed Apr 18, 2012 10:50 am
Posts: 8
hi bolsover
Finally, it works, with 4.1.1.Final, without Class.forName(driver);
i had to add to hibernate.cfg.xml this line

Code:
<property name="hibernate.temp.use_jdbc_metadata_defaults">false</property>


console
Code:
19 avr. 2012 12:04:27 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
19 avr. 2012 12:04:27 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.1}
19 avr. 2012 12:04:27 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
19 avr. 2012 12:04:27 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
19 avr. 2012 12:04:28 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
19 avr. 2012 12:04:28 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
19 avr. 2012 12:04:28 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org/hibernate/tutorial/hbm/Event.hbm.xml
19 avr. 2012 12:04:28 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
19 avr. 2012 12:04:28 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
19 avr. 2012 12:04:28 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 1
19 avr. 2012 12:04:28 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
19 avr. 2012 12:04:28 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@x.y.z.t:1521:mySI]
19 avr. 2012 12:04:28 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=USER, password=****}
19 avr. 2012 12:04:28 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle9iDialect
19 avr. 2012 12:04:28 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000422: Disabling contextual LOB creation as connection was null
19 avr. 2012 12:04:28 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
19 avr. 2012 12:04:28 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
19 avr. 2012 12:04:28 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000227: Running hbm2ddl schema export
Hibernate: drop table EVENTS cascade constraints
Hibernate: create table EVENTS (EVENT_ID number(19,0) not null, EVENT_DATE timestamp, title varchar2(255 char), primary key (EVENT_ID))
19 avr. 2012 12:04:30 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000230: Schema export complete
Hibernate: select max(EVENT_ID) from EVENTS
Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values (?, ?, ?)
Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values (?, ?, ?)
Hibernate: select event0_.EVENT_ID as EVENT1_0_, event0_.EVENT_DATE as EVENT2_0_, event0_.title as title0_ from EVENTS event0_
Event (2012-04-19 12:04:32.434) : Our very first event!
Event (2012-04-19 12:04:33.051) : A follow up event
testBasicUsage...
19 avr. 2012 12:04:34 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
INFO: HHH000030: Cleaning up connection pool [jdbc:oracle:thin:@x.y.z.t:1521:mySI]


best regards
ndhai


Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Thu Apr 19, 2012 6:21 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Hi ndhai

(4.1.1)I was just going to say - not all drivers support databasemetadata which is why you need the (undocumented) <property name="hibernate.temp.use_jdbc_metadata_defaults">false</property> for 9i driver - you could try a later driver?

(4.1.2) It looks like you are making a call to Class.forName(driver); AFTER initialising Hibernate sessionFactory - it must be before this to avoid the problems I have found.


db


Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Thu Apr 19, 2012 6:37 am 
Newbie

Joined: Wed Apr 18, 2012 10:50 am
Posts: 8
bolsover wrote:
(4.1.1)I was just going to say - not all drivers support databasemetadata which is why you need the (undocumented) <property name="hibernate.temp.use_jdbc_metadata_defaults">false</property> for 9i driver - you could try a later driver?


oracle driver? i think jodbc14.jar is for oracle 9.2.0.4.0, right?

bolsover wrote:
(4.1.2) It looks like you are making a call to Class.forName(driver); AFTER initialising Hibernate sessionFactory - it must be before this to avoid the problems I have found.


you are right!
in hibernate.cfg.xml, i had <property name="hbm2ddl.auto">create</property> that initiate Hibernate BEFORE Class.forName(driver);, I'm right?
I made it in comment and then:
-without Class.forName(driver); => ERROR: No suitable driver found for jdbc:oracle:thin:@172.21.1.7:1521:PONDI
-with Class.forName(driver); => no pb

the same results with or without <property name="hibernate.temp.use_jdbc_metadata_defaults">false</property>

ndhai


Top
 Profile  
 
 Post subject: Re: hibernate & oracle: No suitable driver found for jdbc:oracle
PostPosted: Fri Apr 20, 2012 2:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
The forum does not give me an option to "lock" topics, but lets discuss this on the topic https://forum.hibernate.org/viewtopic.php?f=1&t=1015136 instead. Please direct new comments there. Thanks


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