Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate 2.1 and Oracle connection  RSS feed

javaa user
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"

<session-factory >

<!-- local connection properties -->
<property name="connection.url">jdbc racle:thin@url:1521:sid</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.username">username</property>
<property name="connection.password">password</property>
<!-- property name="connection.pool_size"></property -->

<!-- dialect for Oracle 9 -->
<property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>

<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>

<mapping resource="com/test/hibernate/mappings/table.hbm.xml"/>


Above is the config file that i am using to connect to oracle 9i
I have the url, user, password and table = values entered correctly
I am using ojdbc14.jar. I am able to connect to DB from outside.

I am receiving the following error while trying to execute a simple HQL on the table (used in mapping above). can anyone help.. thanks..

Could not obtain connection metadata
java.sql.SQLException: Invalid Oracle URL specified
at oracle.jdbc.dbaccess.DBError.throwSqlException(
at oracle.jdbc.dbaccess.DBError.throwSqlException(
at oracle.jdbc.dbaccess.DBError.throwSqlException(
at oracle.jdbc.driver.OracleDriver.connect(
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(
at net.sf.hibernate.cfg.Configuration.buildSettings(
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(
Kevin St. Clair
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think maybe your Oracle jdbc URL is not formed correctly. Your value:
<code>jdbc racle:thin@url:1521:sid</code>

should probably be:
<code>jdbc racle:thin:@url:1521:sid</code>

The trailing colon after then caused me all kinds of headaches when I tried setting up Oracle with Tomcat 5.0.27 regular pooling.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!