I have tried to make assets folder in different locations in the project and I have MS Access DB file in it. I want to access it using ucanaccess driver. but it gives file not found exception.
DB connectivity code.
public static Statement getConnectionStatement(){
try {
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
String url = "jdbc:ucanaccess://.\\assets\\BC190201004.accdb";
connection = DriverManager.getConnection(url);
return connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
return null;
}
}
but with this code, it is working fine
String url = "jdbc:ucanaccess://C:\\Users\\kha33\\NetBeansProjects\\CS506-Assignment-3\\src\\main\\webapp\\WEB-INF\\assets\\BC190201004.accdb";
I tried to put assets folder under the project main folder, java folder, webapp folder and WEB-INF folder.
I also tried in NetBeans IDE.