I've created my application and tested it under windows, which writes/reads to/from a access DB file.
But in the real world it will be ran in the linux environment, and I have a big issue now, it appears that there are no drivers for linux to access ms acess db, here is how I make the connection now :
private static Connection getConnection() {
if (connection == null) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String conStr = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + configuration.getAccessDbFile();
connection = DriverManager.getConnection(conStr);
} catch (Exception e) {
e.printStackTrace();
}
}
return connection;
}
Has anyone encountered something similar to this, does anybody have a suggestion what could I do ?
This is the exception I get on the linux :
java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
See Question&Answers more detail:os