-->
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.  [ 4 posts ] 
Author Message
 Post subject: Error at session.flush()
PostPosted: Sun Jul 23, 2006 5:11 pm 
Newbie

Joined: Wed Jul 19, 2006 4:34 pm
Posts: 19
I am getting the following error, when a call is made at
Quote:
session.flush()
.

I am using Oracle9. I am not using oracle thin driver. On windows, I configure JDBC-ODBC bridge and datasource name is - test.

When, I ran following code it woked fine for me.
Code:
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      Connection conn = DriverManager.getConnection ("jdbc:odbc:rmdbdatasource","scott","tiger");

Below is my configuration file.
-------------------------------------------------------------------------------------------
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:odbc:test</property>
<property name="hibernate.connection.username">scott</property>
<property name="hibernate.connection.password">tiger</property>
<property name="hibernate.connection.pool_size">1</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="myemp.hbm.xml"/>
</session-factory>
</hibernate-configuration>

The error
---------------------------------------------------------------------------------------------
Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:93)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:86)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:171)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2048)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2427)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:29
7)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:41)
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:545)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:1
10)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
... 14 more[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 23, 2006 5:13 pm 
Newbie

Joined: Wed Jul 19, 2006 4:34 pm
Posts: 19
Small correction at the JDBC URL it is jdbc:odbc:test.

When, I ran following code it woked fine for me.

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection ("jdbc:odbc:test","scott","tiger");

Below is my configuration file.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 24, 2006 10:48 am 
Newbie

Joined: Wed Jul 19, 2006 4:34 pm
Posts: 19
Any idea to this problem?
I suspecting, problem could be Driver class ot dialect but not sure.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 24, 2006 7:28 pm 
Newbie

Joined: Wed Jul 19, 2006 4:34 pm
Posts: 19
It worked, when I changed my URL to jdbc:oracle:thin:@localhost:1521:actualdbname from jdbc:odbc:test. Where test is the JDBC-ODBC configuration from control center .....
I am not sure whether Hibernet supports Type-1 driver, which requires client configuration on client machine.

Thanks


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