hi friends i am new to
jdbc .I want to connect my program to mysql5.0 database.
I compiled the below program from the c:\ drive. But at run time i am getting
classnot found Exception:com.mysql.jdbc.Driver
and in the below program in the
string dburl the hello is the database name which i created
import java.sql.*;
import javax.sql.*;
public class jdbcdemo
{
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String dbtime;
String dbUrl = "jdbc:mysql://localhost:3306/hello";
String dbClass = "com.mysql.jdbc.Driver";
String query = "Select * FROM users";
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection (dbUrl);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
dbtime = rs.getString(1);
System.out.println(dbtime);
} //end while
con.close();
} //end try
catch(ClassNotFoundException e) {
e.printStackTrace();
}
catch(SQLException e) {
e.printStackTrace();
}
}
}