Hallo,
für DSN-lose Connections zu Access via jdbc:odbc funktioniert bei mir Folgendes:
import java.sql.*;
class JDBCAccessDemo {
public static void main(String[] args){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String myDB ="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Dokumente und Einstellungen\\Axel\\Eigene Dateien\\db1.mdb";
Connection con = DriverManager.getConnection(myDB,"","");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM Tabelle1");
while (rs.next()) {
System.out.println(rs.getString(1));
}
} catch(java.lang.ClassNotFoundException cnfe) {
cnfe.printStackTrace();
} catch(java.sql.SQLException sqle) {
sqle.printStackTrace();
}
}
}
Siehe http://www.rgagnon.com/javadetails/java-0345.html und http://www.exampledepot.com/egs/java.sql/LoadDrivers.html.
viele Grüße
Axel