欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

jdbc Access mdb Driver

程序员文章站 2024-02-22 23:18:47
...

最近刚好有个项目要连接ACCESS的MDB数据并导入到ORACLE中,使用

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String strurl="jdbc:odbc:driver={Microsoft Access Driver(*.mdb)};DBQ=E:\\db.mdb";
Connection conn=DriverManager.getConnection(strurl);


时报了以下的错误  java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序,苦与网上基本上找不到原因只能上外文网找找了 

经过GOOGLE后找到一个jstels连接方式http://www.csv-jdbc.com/ 这个网中有比较强大的连接csv\xml\dbf\mdb\engine的驱动,需要的同学可以上这个网上下载
这里提供mdb的连接驱动和使用说明

Installation

Add the driver jar files (mdbdriver.jar + required third-party libraries) to your classpath or extract these jars to the directory of your application.

Driver Classes

 

Description

Classes

Driver class (JDBC API v1.0)

jstels.jdbc.mdb.MDBDriver2

Data Source class (JDBC API v2.0)

jstels.jdbc.mdb.MDBDataSource2

Connection Pool Data Source class (JDBC API v2.0)

jstels.jdbc.mdb.MDBConnectionPoolDataSource2

URL Syntax

The connection URL is jdbc:jstels:mdb:path_to_mdb_file, where path_to_mdb_fileis:

  • an absolute or relative path to a Microsoft Access database (MDB or ACCDB) file, e.g.:

    jdbc:jstels:mdb:c:/mdb_directory/test.mdb

    jdbc:jstels:mdb:mdb_directory/test2.mdb

    jdbc:jstels:mdb:mdb_directory/access2007.accdb

  • path to a file within the CLASSPATH (read-only), e.g.:

    jdbc:jstels:mdb:classpath://resources/test.mdb

  • path to a file within a ZIP (JAR) file (read-only), e.g.:

    jdbc:jstels:mdb:zip://c:/dir/archive.zip/test.mdb

  • path to a file located on a FTP server (syntax: ftp://user:[email protected][:port]/[dirpath/]mdbfile), e.g.:

    jdbc:jstels:mdb:ftp://login:[email protected]:21/mdb_directory/test.mdb

  • SFTP URL to the SFTP-server directory (syntax: sftp://user:[email protected][:port]/[dirpath/]mdbfile, also required third-party libraries Commons VFS and JSch for this protocol), e.g.:

    jdbc:jstels:mdb:sftp://login:[email protected]:22/mdb_directory/test.mdb

  • HTTP URL to a file (read-only), e.g.:

    jdbc:jstels:mdb:http://www.somesite.com/mdb_directory/test.mdb

  • SMB/CIFS URL to a file located on a SMB/CIFS server (e.g.: MS Windows share or Samba server, syntax: smb://[user:[email protected]]hostname/share/[dirpath/]mdbfile):

    jdbc:jstels:mdb:smb://your_server/your_share/mdb_directory/test.mdb

    jdbc:jstels:mdb:smb://login:[email protected]your_server/your_share/mdb_directory/test.mdb

 PS:这个是收费的驱动, 本人已经**。。。如需要可私信我!或者至CSDN下载:http://download.csdn.net/detail/chaico/5072327