Java JDBC Connection Create getAccessConn(String path)

Here you can find the source of getAccessConn(String path)

Description

get Access Conn

License

Open Source License

Declaration

public static Connection getAccessConn(String path) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

import java.sql.SQLException;

public class Main {

    public static Connection getAccessConn(String path) {
        try {//from w w  w  .  j a  v a 2 s.co m
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            String url = "jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=" + path;
            return DriverManager.getConnection(url, "", "");
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return null;
    }
}

Related

  1. clearTable(String tableName, String driver, String url, String user, String password)
  2. createConnection()
  3. createConnection(Properties props, String prefix)
  4. createDatabase(String dbConnectionString, String dbName, String user, String pass, String driver)
  5. createDbConnection(String dbUrl, String dbUser, String dbPass, String dbDriverClass)
  6. getConnect(String driver, String url, String user, String password)
  7. getConnection()
  8. getConnection()
  9. getConnection()