I only give a way to access the database:
private void Login () {
String url = "Jdbc:odbc:driver={microsoft Access driver (*.mdb)};D Bq=pdadb.mdb; Pwd=123 ";
Note that there is a space after driver
Try
{
Class.forName ("Sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (ClassNotFoundException ex)
{
Ex.printstacktrace ();
}
Try
{
Connection con = drivermanager.getconnection (URL);
Statement stmt = Con.createstatement ();
String userpasswd = new String (Pwdpf.getpassword ());
ResultSet rs = stmt.executequery ("SELECT * from password where pwd = '" +userpasswd+ "");
if (!rs.next ())
{
Joptionpane.showmessagedialog (null, "wrong password.") ");
} else
{
Joptionpane.showmessagedialog (NULL, "login succeeded.) ");
}
}
catch (SQLException ex)
{
Ex.printstacktrace ();
}
}
Be sure to note that the string url = "Jdbc:odbc:driver={microsoft Access driver (*.mdb)};D Bq=pdadb.mdb; Pwd=123 "; There is a space after the driver in.