Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Hibernate not connecting to Oracle.

801424Jan 19 2009 — edited Jan 19 2009
Thanks for any help.
I am following the tutorial http://www.visualbuilder.com/java/hibernate/tutorial/setting-up-hibernate/. I think the issue is with the connection to the database.
I have a Oracle 10g Express Edition database my username is ‘system’ and my password is ‘mypass50’

hibernate.cfg.xml is as below



<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">
jdbc:oracle:thin:@localhost:1521:XE, "system", "mypass50";
</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="connection.username">
SYSTEM
</property>
<property name="connection.password">
manager
</property>
<!-- Set AutoCommit to true -->
<property name="connection.autocommit">
true
</property>
<!-- SQL Dialect to use. Dialects are database specific -->
<property
name="dialect">org.hibernate.dialect.OracleDialect</property>
<!-- Mapping files -->
<mapping resource="com/visualbuilder/hibernate/User.hbm.xml" />
<mapping resource="com/visualbuilder/hibernate/PhoneNumber.hbm.xml" />
</session-factory>
</hibernate-configuration>


Part of the error message I am getting is

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)


another part is

Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:XE, "system", "mypass50";
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2009
Added on Jan 19 2009
14 comments
5,743 views