title: How can I connect to an Access database from Java using JDBC?
body: <p>How can I connect to an Access database from Java using JDBC?</p>
  
  <p><strong>Code provided in OP's comment</strong></p>
  
  <pre><code>public static Connection getConnection() throws SQLException { 
      // connection object
      Connection con = null;
  
      // database url
      String connectionString = "jdbc:odbc:Driver= " 
              + "{Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + dbPath;
  
      try {
          Class.forName(driver);
          con = DriverManager.getConnection(connectionString);
      } catch (ClassNotFoundException ex) {
          System.out.println("connot load driver class");
          return con;
      }
  }
  </code></pre>