ucanaccess exception UCAExc:::5.0.1 type not found or user lacks privilege: EXT_DATE_TIME

147 views Asked by At

I am getting this error when running a login screen. I'm really not sure what the issue is as I followed a tutorial, and for him it worked fine. Here is my code:

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);
}

Here are my dependencies:

dependencies

1

There are 1 answers

4
Gustav On

It is probably caused by password being a reserved word.

So, try:

String sq1 = "select * from user_account where username = '" + tfusr.getText() + "' and [password] = '" + tfpwsd.getText() + "'";