Using DSN-less connection : Access « Database « Java Tutorial






import java.sql.Connection;
import java.sql.DriverManager;

public class Main {
  public static void main(String[] argv) throws Exception {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String myDB = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/data.MDB";
    Connection conn = DriverManager.getConnection(myDB, "", "");
  }
}








20.38.Access
20.38.1.Create a connection to MS Access database
20.38.2.Using DSN-less connection