Search code examples
javajdbcucanaccess

How to access a database file on a remote machine via UCanAccess?


I am using the UCanAccess driver from http://ucanaccess.sourceforge.net/site.html

By using this driver I am able to access a local Access database file from Java like this:

conn=DriverManager.getConnection("jdbc:ucanaccess://c:/pippo.mdb;memory=false");) 

When I want to access an Access database file from a remote machine what would be the URL to pass to the getConnection method?


Solution

  • The file on the remote machine must be accessible via Windows file sharing (or equivalent, e.g., a Samba share). The connection URL in your Java application will either use a mapped drive letter (as defined at the OS level)

    DriverManager.getConnection("jdbc:ucanaccess://z:/somefolder/pippo.mdb);
    

    or a UNC path

    DriverManager.getConnection("jdbc:ucanaccess:////servername/sharename/somefolder/pippo.mdb");