Salut à tous,
je cherche à accéder à une base de donnée Access sous Linux, voici le programme que je viens de faire:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| import java.sql.*;
class Main{
public static void main(String[] args){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// set this to a MS Access DB you have on your machine
String filename = "/home/toto/bd.mdb";
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
database+= filename.trim() + ";DriverID=22;READONLY=true}"; // add on to the end
// now we can get the connection from the DriverManager
Connection con = DriverManager.getConnection( database ,"","");
con.close();
}
catch (Exception e) {
System.out.println("Error: " + e);
}
}
} |
En retour, j'ai cette erreur:
Error: java.sql.SQLException: [unixODBC][Driver Manager]Data source name not found, and no default driver specified
Je ne comprends pas trop, quelqu'un peut m'expliquer?
Merci d'avance
Partager