Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes classnotfoundexception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "classnotfoundexception" Watch "classnotfoundexception" New topic
Author

classnotfoundexception

satya narayan reddy
Greenhorn

Joined: Nov 26, 2005
Posts: 13
hi all,
can anybody please fix why the below program is giving classnotfoundexception

thanks in advance,
satya

import java.sql.*;
import java.io.*;
public class JDBCTest
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JDbcOdbcDriver");
Connection c = DriverManager.getConnection("jdbc dbc:venkatdsn");
Statement st = c.createStatement();
ResultSet rs =st.executeQuery("Select sno,sname from student");
try
{
while(rs.next())
{
System.out.println(rs.getInt("sno")+":");
System.out.println(rs.getString("sname"));
}
}
catch(Exception e)
{
System.out.println("inside:"+e);
}
}
catch(Exception e)
{
System.out.println(e);
}

}


}


Runtime Exception:
--------------------
java.lang.ClassNotFoundException:sun.jdbc.odbc.JDbcOdbcDriver
trinadh reddy
Ranch Hand

Joined: Sep 22, 2005
Posts: 60
give the classname as
sun.jdbc.odbc.JdbcOdbcDriver
sailesh sirari
Greenhorn

Joined: Aug 16, 2005
Posts: 9
hi


Class.forName("sun.jdbc.odbc.JDbcOdbcDriver");


this line should be

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

be careful for typos as it will not give error

Cheers!

Sailesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: classnotfoundexception