Marceli napisał(a)
private final String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
private final String dbUrl = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=housing.mdb;DriverID=22;READONLY=false";
HTH. Pozdr.
Dzięki za pomoc, wreszcie się za to wziĄłem, ale dalej mam problem.
Wpisałem, jak poniżej, ale zamiast zmodyfikować plik a.mdb to tworzy się plik a.ldb, którego nie potrafię nawet otworzyć z accessa. Co robie źle?
Connection connection = null;
try {
// Load the JDBC driver
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
Class.forName(driverName);
// Create a connection to the database
String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=/a.mdb;DriverID=22;READONLY=false";
String username = "";
String password = "";
connection = DriverManager.getConnection(url, username, password);
Statement stmt = connection.createStatement();
String sql = "UPDATE tab SET imie = " + "tomek";
stmt.executeUpdate(sql);
} catch (ClassNotFoundException e) {
// Could not find the database driver
} catch (SQLException e) {
// Could not connect to the database
}