Search code examples
javaazurejdbcucanaccess

No suitable driver found for jdbc:ucanaccess: i got this error when i try connect to Ms access database


I trying to get data from ms access database stored in Azure File Storage. I set right path to storage, but when I try to get data from base I got this error.My application work fine when ms access database is on my machine.

This is my code:

Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
connection = DriverManager.getConnection("jdbc:ucanaccess:http://example/example/example/Database.accdb");

When I change the url I get error

net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.2 given file does not exist:.


Solution

  • I downloaded the zip file of UCanAccess source code and viewed it, it seems not to be the ability to connect the access database file via network protocols like HTTP, besides via the url of local filesystem like //c:/... on Windows or ///path/... on Unix-like OS.

    So for implementing your needs, there are two solutions as below.

    1. First download the access database file you need to the running environment, then to use it and to back it up to Azure File Storage.
    2. Recommended. Follow the Azure offical tutorial for Windows or Linux to create a file share, and mount the file share using SMB protocol as a local filesystem on your OS, then to use your access file like a local file.

    Hope it helps.