Compatibility issues with Oracle 10g and JDk1.6?

patil.ashu01

patil.ashu01

@patilashu01-wqV4iY Oct 21, 2024
Hi. I am trying to make a database connection in Eclipse with Class.forName("oracle.jdbc.driver.OracleDriver") or DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()). I have also added an external jar file classes12.jar but I am getting an exception :

java.lang.ClassNotFoundException: oracle.jdbc.Driver.OracleDriver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at LoginDAO.<init>(LoginDAO.java:9)
at Hello.doGet(Hello.java:30)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) .....

even if there is no compilation error. I am using Oracle 10g and JDK1.6 . Is there any need to include other jar files or configure anything else??? Please help.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Anand Tamariya

    Anand Tamariya

    @anand-tamariya-DnfjEX Apr 24, 2013

    It's clearly a classpath issue. Where have you added classes12.jar?
  • patil.ashu01

    patil.ashu01

    @patilashu01-wqV4iY Apr 24, 2013

    Anand Tamariya
    It's clearly a classpath issue. Where have you added classes12.jar?
    in eclipse through Configure build path-> add external jar files->select classes12.jar. this is displayed under libraries. I tried it this way that removed a compilation error in Class.forName() but gives an exception.
  • Anand Tamariya

    Anand Tamariya

    @anand-tamariya-DnfjEX Apr 25, 2013

    Put it in WEB-INF/lib folder.
  • patil.ashu01

    patil.ashu01

    @patilashu01-wqV4iY Apr 26, 2013

    I copied the file in WEB-INF/lib. bt getting the same exception
  • patil.ashu01

    patil.ashu01

    @patilashu01-wqV4iY Apr 26, 2013

    patil.ashu01
    I copied the file in WEB-INF/lib. bt getting the same exception
    I am using a tomcat server.. so is the problem arising due to oracle 10g,jdk1.6 and tomcat v6.0???? Please help.. I am stuck here..
  • patil.ashu01

    patil.ashu01

    @patilashu01-wqV4iY Apr 26, 2013

    patil.ashu01
    I copied the file in WEB-INF/lib. bt getting the same exception
    finally its done.... THANK YOU... As #-Link-Snipped-#, you said I had to set a classpath environmental variable. but I couldnt do it from cmd prompt but from my computer->manage->environmental variable. But both the methods do the same. rite??? then y cant i do it through cmd prompt???? And also classes12.jar file has to be included under WEB-INF/lib , otherwise an exception is raised. but this works with jboss by simply including jar files using Build path->configure build path->libraries->add external jars.
  • Anand Tamariya

    Anand Tamariya

    @anand-tamariya-DnfjEX Apr 27, 2013

    Variables set in a cmd prompt is only available in that session, one set via computer->manage->environmental variable is available to all new processes. Some server plugins in eclipse use the project classpath setting. Hence, you don't see the issue with JBoss. But it's not a fool-proof mechanism. For a web app, the proper way to provide for Jars is to put them under WEB-INF/lib.