-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: newbie question
PostPosted: Sat Nov 08, 2003 12:25 pm 
Newbie

Joined: Sat Nov 08, 2003 12:09 pm
Posts: 1
I am using Oracle thin drive to test out few examples. For some reasons, hibernate code can locate my classes12.zip (oracle JDBC implementation). It is in my classpath because I can use direct JDBC call with no problems.

Thanks.

EXAMPLE CODE:

public class Test
{
public void someDBTest() throws Exception
{
String url = "jdbc:oracle:thin:@localhost:1521:was";
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn =
DriverManager.getConnection(url, "ejsadmin", "ejsadmin");
DatabaseMetaData meta = conn.getMetaData();
//ResultSet rs = meta.getTables(null, null, null, null);
ResultSet rs = meta.getSchemas();
while (rs.next())
{
System.out.println(rs.getString("TABLE_SCHEM"));
}
}

public static void main(String[] args) throws Exception
{
Test test = new Test();
//I'm only doing this to prove the point that I can see driver classes.
test.someDBTest();

//HERE IS THE ERROR PART???
SessionFactory factory =
new Configuration().configure().buildSessionFactory();
}
}



OUTPUT:

It prints out all the content I'm requested from the DB but give me
error when try to get SessionFactory as:

[FATAL] DriverManagerConnectionProvider - -JDBC Driver class not found: oracle.jdbc.driver.OracleDriver
Exception in thread "main" net.sf.hibernate.HibernateException: JDBC Driver class not found: oracle.jdbc.driver.OracleD
river
at net.sf.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:57
)
at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83
)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:153)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)
at Test.main(Test.java:13)



HIBERNATE CONFIG FILE:

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

<!-- Generated file - Do not edit! -->

<hibernate-configuration>

<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory name="HibernateFactory">

<!-- properties -->
<property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </property>
<property name="connection.url"> jdbc:oracle:thin:@localhost:1521:was </property>
<property name="connection.username"> ejsadmin </property>
<property name="connection.password"> ejsadmin </property>
<property name="dialect"> net.sf.hibernate.dialect.OracleDialect </property>
<property name="show_sql">false</property>
<property name="use_outer_join">false</property>


<!-- mapping files -->
<mapping resource="com/test/Customer.hbm.xml" />
</session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject: Re: newbie question
PostPosted: Sat Nov 08, 2003 2:19 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
hibernator2 wrote:
<property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </property>
<property name="connection.url"> jdbc:oracle:thin:@localhost:1521:was </property>
<property name="connection.username"> ejsadmin </property>
<property name="connection.password"> ejsadmin </property>
<property name="dialect"> net.sf.hibernate.dialect.OracleDialect </property>


must be
Code:
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:was</property>
<property name="connection.username">ejsadmin</property>
<property name="connection.password">ejsadmin</property>
<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>


Remove extra whitespace inside property body

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 08, 2003 9:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Hmmmm. we should trim, I suppose.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.