其他分享
首页 > 其他分享> > 【JDBC】Extra04 Mirosoft-Access-JDBC

【JDBC】Extra04 Mirosoft-Access-JDBC

作者:互联网

MS没提供Jdbc驱动,有一个第三方的UcanAcess驱动包

<!-- https://mvnrepository.com/artifact/net.sf.ucanaccess/ucanaccess -->
<dependency>
    <groupId>net.sf.ucanaccess</groupId>
    <artifactId>ucanaccess</artifactId>
    <version>5.0.0</version>
</dependency>

连接单元测试:

    @Test
    public void connectionTest() throws Exception {
        Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
        final String microSoftAccessDataBaseLocation = "C:\\Users\\Administrator\\Documents\\sample.accdb";
        final String UcanAccessConnectUrl = "jdbc:ucanaccess://" + microSoftAccessDataBaseLocation;
        Connection connection = DriverManager.getConnection(UcanAccessConnectUrl);
        System.out.println(connection);
        connection.close();
    }

打印结果:

13:33:50.933 [main] DEBUG com.healthmarketscience.jackcess.Index - unsupported collating sort order SortOrder[2052(0)] for text index (Db=sample.accdb;Table=MSysObjects;Index=0), making read-only
13:33:50.950 [main] DEBUG com.healthmarketscience.jackcess.impl.DatabaseImpl - Could not find expected index on table MSysObjects (Db=sample.accdb)
13:33:50.968 [main] DEBUG com.healthmarketscience.jackcess.impl.DatabaseImpl - Finished reading system catalog.  Tables: [user] (Db=sample.accdb)
net.ucanaccess.jdbc.UcanaccessConnection@5b03b9fe[C:\Users\Administrator\Documents\sample.accdb]

 

标签:accdb,sample,JDBC,healthmarketscience,Db,Access,Extra04,ucanaccess,jackcess
来源: https://www.cnblogs.com/mindzone/p/13749238.html