wood burning stoves 2.0*
The moose likes JDBC and the fly likes oracle.jdbc.driver.OracleDriver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "oracle.jdbc.driver.OracleDriver" Watch "oracle.jdbc.driver.OracleDriver" New topic
Author

oracle.jdbc.driver.OracleDriver

arunkumar hk
Greenhorn

Joined: Mar 03, 2001
Posts: 5
Hi,
I have a java program code is as below

import java.sql.*;
import java.io.*;
class demo
{
static Connection Con;
public static void main ( String [] str) throws Exception
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Con = DriverManager.getConnection("jdbc racle:thin:@192.20.200.99:1521:demo","scott","tiger");
Statement stmt = Con.createStatement();
ResultSet rs = stmt.executeQuery("select * from tab");
while(rs.next())
{
System.out.println(rs.getString(1));
}
}
catch( Exception e)
{
e.printStackTrace();
}
}
}
while executing i am getting the below error mesg, i have set the classpath and path correctly, pls tell the solution.

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at demo.main(demo.java:11)
Press any key to continue . . .

rgds
arun.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
The solution is to place your oracle driver in your classpath so that it can be found.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
arunkumar hk
Greenhorn

Joined: Mar 03, 2001
Posts: 5
Hi,
Thx for the reply, I have set the classpath, but still the problem exists it gives as
java.sql.SQLException: No more data to read from socket
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:411)
at oracle.jdbc.ttc7.TTCInBuffer.getByte(TTCInBuffer.java:94)
at oracle.jdbc.ttc7.TTIMsg.unmarshalSB1(TTIMsg.java:1085)
at oracle.jdbc.ttc7.O3log.receive2nd(O3log.java:603)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:168)
at oracle.jdbc.driver.OracleConnection.<init> (OracleConnection.java:103)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:148)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at demo.main(demo.java:12)
thx and rgds
arun.
 
GeeCON Prague 2014
 
subject: oracle.jdbc.driver.OracleDriver