Ramesh Kotha Ramesh Kotha - 3 months ago 62
Java Question

No suitable driver found for jdbc:oracle:thin:@localhost:1521:XE when running web application

I am experiencing the strange problem with

No suitable driver found for jdbc:oracle:thin:@localhost:1521:XE


when i run JUNIT Test case of any DAO it is inserting fine. But when i run in server it is giving
No suitable driver found for jdbc:oracle:thin:@localhost:1521:XE


i have added ojdbc14.jar to WEB-INF/lib folder.

here is the jdbc.properties

jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:XE
jdbc.username=system
jdbc.password=pwd


please help me.

Answer

The problem is its not loading the Oracle Driver

added this in Controller, every thing is working fine.

static{
    try {
        Class.forName ("oracle.jdbc.OracleDriver");
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}
Comments