Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Hibernate 2.1 and Oracle connection

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(
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.
Water proof donuts! Eat them while reading this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic