Private Boolean checkloginfromaccess (string ID, string pswd ){
Preparedstatement stmt = NULL;
Resultset rest = NULL;
Connection conn = NULL;
String Path = This. getservletcontext (). getrealpath ("") + "/WEB-INF/lib/hr. mdb ";
String url = "JDBC: ODBC: Driver = {Microsoft Access Driver (*. mdb)}; DBQ =" + path;
Try {
Class. forname ("Sun. JDBC. ODBC. jdbcodbcdriver"); // JDBC-ODBC
Conn = drivermanager. getconnection (URL );
String SQL = "select * from user where account =? And Password =? ";
Stmt = conn. preparestatement (SQL );
Stmt. setstring (1, ID );
Stmt. setstring (2, pswd );
Rest = stmt.exe cutequery ();
If (rest. Next ()){
Return true;
}
} Catch (classnotfoundexception e ){
E. printstacktrace ();
} Catch (sqlexception e ){
E. printstacktrace ();
} Finally {
Try {
If (stmt! = NULL ){
Stmt. Close ();
}
If (Conn! = NULL ){
Conn. Close ();
}
} Catch (sqlexception e ){
E. printstacktrace ();
}
}
Return false;
}