ucanaccess 异常 UCAExc:::5.0.1 类型未找到或用户缺乏权限:EXT_DATE_TIME

问题描述 投票:0回答:1

运行登录屏幕时出现此错误,真的不确定问题是什么,因为我按照教程进行操作,对他来说效果很好,这是我的依赖项和代码

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
Connection con = null;
    PreparedStatement pst = null ; 
    ResultSet rs = null;

try{
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
con = DriverManager.getConnection("jdbc:ucanaccess://C:\\Users\\Morgan\\Documents\\Database1.accdb");
String sq1 = "select * from user_account where username = '"+ tfusr.getText() +"' and password = '"+ tfpwsd.getText() +"' ";
pst = con.prepareStatement(sq1);
rs = pst.executeQuery();
if(rs.next())
{
JOptionPane.showMessageDialog(null,"Login successfull");
}
else {
JOptionPane.showMessageDialog(null , "Login Failed");
}
}
catch(Exception e){
    System.out.println(e);
}

enter image description here

java ms-access netbeans ucanaccess
1个回答
0
投票

这可能是由于password是保留字造成的。

所以,尝试一下:

String sq1 = "select * from user_account where username = '" + tfusr.getText() + "' and [password] = '" + tfpwsd.getText() + "'";
© www.soinside.com 2019 - 2024. All rights reserved.