Hi....I need help...I'm new using Java and Hibernate and I'm trying to do a web application but I'm having serious problems because I'm having an error that say "No suitable driver found for jdbc:oracle:thin:@172.18.25.101:1521:ORCL" I already debug my application and I know that the error is throw when I try to begin the transaction.
Here is my .java that throws the problem
Code:
public class TestEmployee {
/**
* @param args
*/
public static void main() {
AnnotationConfiguration config = new AnnotationConfiguration();
config.addAnnotatedClass(Employee.class);
config.configure("hibernate.cfg.xml");
//new SchemaExport(config).create(true, true);
SessionFactory factory = config.buildSessionFactory();
Session session = factory.getCurrentSession();
session.beginTransaction(); <----this line throw the error.
{
Employee alex = new Employee();
//alex.setEmpId(100);
alex.setEmpName("Alex Berry");
alex.setEmpEmailAddress("alex@hibernate.com");
alex.setEmpPassword("alexpass");
alex.setPermanent(true);
alex.setEmpJoinDate(new GregorianCalendar(2009,05,26));
alex.setEmpLoginTime(Date.valueOf("2010-06-05"));
session.save(alex);
}
session.getTransaction().commit();
}
}
And this is my hibernate.cfg.xml
Code:
<?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="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@172.18.25.101:1521:ORCL</property>
<property name="hibernate.connection.username">SERVICIOS</property>
<property name="hibernate.default_schema">SERVICIOS</property>
<property name="hibernate.connection.password">SERVICIOS</property>
<property name="hibernate.connection.pool_size">2</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.show_sql">true</property>
</session-factory>
</hibernate-configuration>
The way that I'm invoking my TestEmployee.java is this:
Code:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
//private String[] afa;
TestEmployee t = new TestEmployee();
t.main();
%>
<a>prueba</a>
</body>
<%@page import="com.hibernate.chapter1.TestEmployee"%></html>
Please help me I don't know how to solve this.
Thanks!!!! And Sorry for the English but I'm not natural speaker.