How can use relative paths in database connection?
public class ConnectionManager { File file = new File("Data/Uni.accdb"); private static String dbPath = file.getAbsolutePath(); private static String url = "jdbc:ucanaccess:// '"+dbPath+"' "; //I have an error here private static String driverName = "net.ucanaccess.jdbc.UcanaccessDriver"; private static Connection connection; private static String urlstring; public static Connection getConnection() { try { Class.forName(driverName); try { connection = DriverManager.getConnection(url); } catch (SQLException ex) { System.out.println("Failed to create the database connection."); } } catch (ClassNotFoundException ex) { System.out.println("Driver not found."); } return connection; } } // if remove static, can not get getConnection in other classes.