• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

classnotfoundexception

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
give the classname as
sun.jdbc.odbc.JdbcOdbcDriver
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic