This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

hibernate + oracle

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I want to connect to the oracle database using hibernate.


but when im trying retrieve object from database im getting exception
org.hibernate.exception.GenericJDBCException


this is what i used in hibernate configuration file.

<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc racle:thin:@127.0.0.1:1521 RA920</property>
<property name="hibernate.connection.username">sys</property>
<property name="hibernate.connection.password">dba</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>

can any one help
regards
Anuja K.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried posting this to the Hibernate forum (available via hibernate.org)?
 
anuja Edathu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi keith,
i didn't thanks for ur advice i'll try.Do you have any suggestion?please reply
regards
Anuja
 
Keith Pitty
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not with the information you have supplied. The whole stack trace as well as the code snippet may help shed more light on the problem.
 
anuja Edathu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have downloaded and installed oracle 9.2.04 for linux on one m/c
downloaded and put the ojdbc14.jar in the lib directory along with other jar files.Do i need to have any other jar files?


<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<!-- <property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:microsoft:sqlserver://192.168.3.7:1433; DATABASENAME = sample</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>-->
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc racle:thin:@192.168.3.16:1521 RA920</property>
<property name="hibernate.connection.username">sys</property>
<property name="hibernate.connection.password">dba</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>

<!-- Mapping files -->
<mapping resource="rolemaster.hbm.xml"/>
<mapping resource="usermaster.hbm.xml"/>

</session-factory>
</hibernate-configuration>

I've written two java classes with getter and setter method.created another java class for retrieving the values.and needed hibernate mapping file.

I tried my code with sql server it is working(with the block that is commented now).
i created TABLE for both sql and oracle.

Will this help?(I am new to Oracle and hibernate)


Thanks and Regards
Anuja K
 
Keith Pitty
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried a simple program using JDBC to test that you are using the correct database driver and URL for Oracle?
 
anuja Edathu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you,
I could solve it.I created and connected using the new user name and password,
any way i don't know why couldn't i get connected as sys dba.

Regards
Anuja K.
 
anuja Edathu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I do have another problem . I deployed my files to tomcat and its fine exxcept I have to put all the hibernate mapping files and hibernate configuration in the WEB-INF/classes along with the java class files.
When i m taking that out to lib its showing error like the hibernate.cfg.xml not found.

Is there any way to remove the xmls from the WEB-INF/classes


Regards
Anuja K.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They need to be in the classpath, otherwise how can Hibernate find them?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hay all,
I had similar problem all the code work for Mysql but not for Oracle 9. My JDBC test program for ORACLE I did test and it work!!!
I am thinking configuration or mapping issue!
 
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic