Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDr
iver? I get this error at run time.I used oracle10G. I set
CLASS PATH:C:\oraclexe\app\oracle\product\10.2.0
\server\jdbc\lib\ojdbc14.jar;
I write JDBC PROGRAM like
import java.sql.*;

class Example
{
public static void main(String args[])
{
try
{
Class.forName
("oracle.jdbc.driver.OracleDriver");
System.out.println("Driver Loaded");
Connection con=DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:xe","system","salmas");
System.out.println("Driver Connected");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from
emp");
while(rs.next())
{
System.out.println(rs.getInt(1));
System.out.println(rs.getString(2));
System.out.println(rs.getString(3));
}
st.close();
con.close();
}

catch(Exception e)
{
System.out.println(e);
}

finally
{
System.out.println("it's
finally block executed");
}

}
}

Answers were Sorted based on User's Feedback



java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDr iver? I get this error at run time.I ..

Answer / amit singh

have you set the enoviornment variable if not then beacuse
of this the driver can not be load
because which you path
Class.forName
("oracle.jdbc.driver.OracleDriver");
in Class.forName("String" )
compiler search it out in bin/lib of jre or jre bin/lib/ext
so please check it out because of it this excption commonly
come
because if some one used Mysql and i did in past i got thsi
exception because it didn't set the Classpath for connection.jar
so do it getridof this thing
thanks
amitsing2008@gmail.com
amit09mca

Is This Answer Correct ?    2 Yes 0 No

java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDr iver? I get this error at run time.I ..

Answer / mohit

i hav faced same problem...
still i didnt get right answere

Is This Answer Correct ?    1 Yes 2 No

java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDr iver? I get this error at run time.I ..

Answer / deepak

just find the file named classes.jar in the oracle installed
directory.and copy the full address of classes.jar with the
file name and goto command prompt and write the
(this is for oracle 11g)

c:\>set
classpath=D:\app\Deepak\product\11.2.0\dbhome_1\oui\jlib\classes12.jar;.;

this sets ur classpath teprorily for that session
now run the command for checking that the classpath is seted
properly.
c:\>java oracle.jdbc.driver.OracleDriver
Exception in thread "main" java.lang.NoSuchMethodError: main

if this is shown then now u can run ur program.

Is This Answer Correct ?    2 Yes 4 No

java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDr iver? I get this error at run time.I ..

Answer / renuka

I have tried that I got this

C:\connection>java oracle.jdbc.driver.OracleDriver
Exception in thread "main" java.lang.NoSuchMethodError: main

but still my program is not running. I am getting the
following error

C:\connection>java -classpath . getOracleConnection
Exception in thread "main" java.lang.NoClassDefFoundError:
oracle/jdbc/OracleDri
ver
at DB.dbConnect(getOracleConnection.java:26)
at getOracleConnection.main(getOracleConnection.java:10)
Caused by: java.lang.ClassNotFoundException:
oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at
java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)

Is This Answer Correct ?    0 Yes 2 No

java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDr iver? I get this error at run time.I ..

Answer / vishnu

iam usin type 4 driver .using oracle 10g.when i am trying to run the code error came like this Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.
OracleDriver.

Is This Answer Correct ?    0 Yes 2 No

java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDr iver? I get this error at run time.I ..

Answer / vijay

Hey,
You are written In valid Driver name
use following script
Then you can't get that problam.

Class.forName("oracle.jdbc.Driver.OracleDriver");

in Driver "D" should capital

Is This Answer Correct ?    1 Yes 16 No

Post New Answer

More JDBC Interview Questions

How to make updates to updatable result sets in jdbc?

0 Answers  


Can I use JDBC to execute non-standard features that my DBMS provides?

0 Answers  


There is a method getColumnCount in the JDBC API. Is there a similar method to find the number of rows in a result set?

0 Answers  


How to connect multiple database in jdbc?

0 Answers  


What is device controller?

0 Answers  


What is the function of setautocommit?

0 Answers  


What is jdbc url for mysql?

0 Answers  


What is the use of prepared statement?Ans:used to execute pre compiled statement...so the question is when that precompiled statement will be execute or comiple?................

6 Answers   TCS,


How does a custom RowSetReader get called from a CachedRowSet?

0 Answers  


What is the syntax of URL to get connection?

1 Answers  


What is difference between java.util.Date and java.sql.Date?

0 Answers  


What is odbc and jdbc drivers?

0 Answers  


Categories