im using ucancess 2.0.9.2 in android studio 2022
im trying to write to an access table but for some reason I cant even make the connection.
the error I'm getting: I/System.out: net.ucanaccess.jdbc.UcanaccessSQLException: given file does not exist: C:/Users/XXORX/Desktop/try/test.accdb
here's the code:
Connection con; // for connecting to DB
Statement stmt; // for running query
String str;
try {
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
String url = "jdbc:ucanaccess://E:\\Database2.accdb";
con = DriverManager.getConnection(url);
stmt = con.createStatement(); // Create statement
// for creating table
str = "CREATE TABLE ALBUMS (Title VARCHAR(50), Performer VARCHAR(50), Price DOUBLE )";
// execute query
stmt.executeUpdate(str);
str = "INSERT INTO ALBUMS VALUES ('Let It Be' , 'Beatles', 60 )";
stmt.executeUpdate(str);
str = "INSERT INTO ALBUMS VALUES ( 'Imagine' , 'John Lennon', 50 )";
stmt.executeUpdate(str);
str = "INSERT INTO ALBUMS VALUES ('The Wall' , 'Pink Floyd', 55 )";
stmt.executeUpdate(str);
stmt.close(); // Close connection
con.close();
} catch (Exception e) {
System.out.println(e);
}