I am getting this exception while deploying my application on Tomcate version:5.5.26
Application type: Web based(Spring).
java version: 1.6
Database: Oracle 10g Exp.
Driver: ojdbc6 (from oracle site for java 1.6)
I am attaching jdbc.properties file. And It is running perfeclty fine from inside Eclipse(3.5.1). I have a
test class to check the problem.
Real Exception :
org.apache.commons.dbcp.SQLNestedException: Cannot create
JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL '"jdbc:oracle:thin:@localhost:1521:orcl"'
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1150)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
java code: It running fine. Problem is only from
Tomcat deployment.
String url = "jdbc:oracle:thin:@localhost:1521:orcl";
String userName = "orbgang";
String password = "admin";
Class.forName("oracle.jdbc.driver.OracleDriver");
java.sql.Driver driver = null;
driver = DriverManager.getDriver(url);
System.out.println("Driver name::"+driver.getMajorVersion());
java.sql.Connection connection = DriverManager.getConnection(url, userName, password);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("select * from COUNTRIES");
while(resultSet.next()) {
System.out.println("countries Name !!"+resultSet.getString("COUNTRY_NAME"));
}