Sunday, December 23, 2012

Create a connection to MS Access database

4:40 AM

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

public class Main {
  // private static final String URL = "jdbc:odbc:TestDB";

  private static final String USERNAME = "admin";

  private static final String PASSWORD = "welcome";

  private static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";

  private static final String URL
 = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\Database\\testdb.mdb;}";

  public static void main(String[] argsthrows Exception {

    Class.forName(DRIVER);
    Connection connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);

    connection.close();
  }
}

Written by

We are one of the initiators of the development of information technology in understanding the need for a solution that is familiar and close to us.

0 comments:

Post a Comment

 

© 2013 Klick Dev. All rights resevered.

Back To Top