Results 1 to 2 of 2
  1. #1
    abrahamthomas is offline Member
    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    Default OJDBC connection error

    Hi
    I am using Oracle 11g and java 1.7.
    When i am trying to connect, it is throwing classnot found exception.

    my code:
    {
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    Class.forName("oracle.jdbc.OracleDriver");

    con=DriverManager.getConnection("jdbc:oracle:thin: @127.0.0.1:1521:XE","system", "password");
    }

    stacktrace:

    SEVERE: Servlet.service() for servlet Login_Servlet threw exception
    java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver
    at container.JdbcConnection.Connections.connections(C onnections.java:15)
    at container.persistance.Login_Retrive_Details.valida teUser(Login_Retrive_Details.java:39)
    at container.servlet.Login_Servlet.doPost(Login_Servl et.java:46)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:602)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:489)
    at java.lang.Thread.run(Unknown Source)

    ps: i am running from eclipse

    i have verified my class path throuch command line its working as expected.
    In my classpath i havd ojdb14,5,6,6_g.
    also added the build path in eclipse to the same jars.

    please help..........

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,953
    Rep Power
    19

    Default Re: OJDBC connection error

    How are you running the above code?
    Because, whatever you say aside, you do not have the ojdbc jar file (and you only want the one, not every one you can get your hands on) in your runtime classpath.

    By the way, there is no need to register the driver these days. Haven't needed to do that since (I think) 1.5.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. error with connection Mysql
    By ahmadn in forum Java Applets
    Replies: 5
    Last Post: 06-17-2011, 10:54 AM
  2. I/O Error: Connection reset...
    By dkennelly in forum Java Servlet
    Replies: 5
    Last Post: 09-17-2010, 03:12 PM
  3. error in Connection
    By sabra in forum JDBC
    Replies: 1
    Last Post: 06-12-2010, 12:02 PM
  4. Connection Error
    By meMalik in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 02-22-2010, 06:13 PM
  5. error I/O connection
    By bbq in forum JDBC
    Replies: 1
    Last Post: 07-05-2007, 01:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •