File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Hibernate 2.1 and Oracle connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate 2.1 and Oracle connection " Watch "Hibernate 2.1 and Oracle connection " New topic

Hibernate 2.1 and Oracle connection

javaa user

Joined: Sep 27, 2004
Posts: 1
<?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

Joined: Aug 07, 2004
Posts: 2
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.
I agree. Here's the link:
subject: Hibernate 2.1 and Oracle connection
It's not a secret anymore!