some problem in JDBC operation
hi,
i have this problem i am new to JDBC and i wrote a sample program to try out , when i complied the program it compiled fine but when i ran the program
java progname
i got a class not defined error , below is my sample code
please can anybody tell me where the problem is
import java.sql.*;
public class JDBCTry
{
public static void main(String arg[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection DBconn = DriverManager.getConnection("jdbc:odbc:technical_library");
System.out.println("connected");
Statement st = DBconn.createStatement();
ResultSet rs = st.executeQuery("Select lastname,firstname from authors");
while(rs.next())
{
System.out.println(rs.getString("lastname"));
System.out.println(rs.getString("firsttname"));
System.out.println("\n");
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
regards
raghav
[1052 byte] By [
raghav21] at [2007-9-26 2:01:46]

no the problem is that when i do
java JDBCTry i get a statement
error in main ClassNotDefined:JDBCTry
where can the problem be , i have checked my odbc setting , every thing is fine ,or is there any problem with the sun.jdbc.odbc.JdbcOdbcDriver
regards
Raghav
hi
can some body tell me what the problem can be , itried with jdk1.2 jdk1.3 every thing , when i run i get
classnotdefined error , is it a problem with my OS, i am running on win98 or the sun.jdbc.odbc.JdbcOdbcDriver is corrupted .because the error is caught in the
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver "); statement
is there any other way without using Class.forName()
thing
regards
raghav
How do you write it exactly?
in your first post:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
in your last post:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver ");
with a blank at the end of the string.
This would cause an exception.