-
Java连接Access数据库所使用的驱动程序
资源介绍
java连接Access数据库操做数据库驱动
连接方法:
public static Connection getNativeConnection(){
try {
if(nativeConnection!=null && !nativeConnection.isClosed()){
return nativeConnection;
}else{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String dburl = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+SysPath.getAccessPath();// 此为NO-DSN方式
Connection conn = DriverManager.getConnection(dburl,"Administrator","123");
nativeConnection = conn;
return nativeConnection;
}
} catch (Exception e) {
com.hzfy.util.log.Log4jApp.getLogger().error("得到本地ACCESS数据库的连接异常"+e.getLocalizedMessage());
return null;
}
}
连接方法:
public static Connection getNativeConnection(){
try {
if(nativeConnection!=null && !nativeConnection.isClosed()){
return nativeConnection;
}else{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String dburl = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+SysPath.getAccessPath();// 此为NO-DSN方式
Connection conn = DriverManager.getConnection(dburl,"Administrator","123");
nativeConnection = conn;
return nativeConnection;
}
} catch (Exception e) {
com.hzfy.util.log.Log4jApp.getLogger().error("得到本地ACCESS数据库的连接异常"+e.getLocalizedMessage());
return null;
}
}
- 上一篇: access64位驱动程序安装包
- 下一篇: jsp Access驱动包