• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

java. lang. Class Not FoundException:

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iam using oracle10g at the backend.I tried a simple JDBC program to check the jdbc connection with the database.

I have set the path for oracle bin folder in the System Variable "Path"
I have given the path for ojdbc14.jar file in the system variable "Classpath"

Here is the code.

import java.sql.*;
class TestConnection
{
public static void main(String[] args)
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection ("jdbc: oracle: thin: @localhost: 8080 rcl","system","abhishek");
Statement stm=con.createStatement();
System.out.println("Connection established successfully");
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}

The code compiled fine and raised an exception at runtime
java. lang. ClassNot FoundException: oracle. jdbc.driver. OracleDriver
at java. net. URLClass Loader$1.run (Unknown Source)
-------------------
at sql.OracleTest.main(OracleTest.java:11)

give the solution for this problem.thanks in advance
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It still is a classpath issue. When you run java, it is at that point that you need the Oracle JDBC Driver in the classpath. A System variable usually doesn't do the trick.

Mark
 
Abhishek Reddy
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.
I have set the Oracle JDBC Driver at runtime.This time iam getting different error..

java.sql.SQLException: Io exception: Got minus one from a read call
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
n.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at sql.OracleTest.main(OracleTest.java:12)

How to resolve this problem?
 
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic