无法连接到共享驱动器上的数据库 - UCanAccess [英] Unable to connect to a database on a shared drive - UCanAccess
问题描述
我已经将我的应用程序设置为通过UCanAccess连接到Access数据库但是我无法连接到位于共享驱动器上的数据库。请参阅下面的示例。
I've setup my application to connect to a Access database through UCanAccess however I'm unable to connect to a database that is located on the shared drive. See below for examples.
String databasePath = "jdbc:ucanaccess://C:/Desktop/MyDB.accdb" \\\\ this works
String databasePath = "jdbc:ucanaccess://servername/etc/MyDB.accdb" \\\\ does not work and throws no suitable driver found exception
当我将共享驱动器上的文件夹映射到某个字母时足够有趣,例如P: - 它成功连接。
Interesting enough when I map my folder on the shared drive to some letter e.g. P: - it successfully connects.
String databasePath = "jdbc:ucanaccess://P:/servername/etc/MyDB.accdb" \\\\ this works
有可能解决这个问题吗?我的用户对该文件夹具有r / w权限,但我不想在每台计算机上映射驱动器。
谢谢
Is it possible to go around this? My users have r/w permissions to the folder but I don't want to map drives on each machine. Thanks
推荐答案
您的连接URL中没有足够的正斜杠来表示UNC路径。如您所知,对于 C:\Desktop \ MyDB.accdb
的本地连接,您可以使用
You simply don't have enough forward slashes in your connection URL to represent a UNC path. As you have noted, for a local connection to C:\Desktop\MyDB.accdb
you can use
String databasePath = "jdbc:ucanaccess://C:/Desktop/MyDB.accdb";
同样,对于与 \\servername \ ec的UNC连接\ MyDB.accdb
你可以使用
Similarly, for a UNC connection to \\servername\etc\MyDB.accdb
you can use
String databasePath = "jdbc:ucanaccess:////servername/etc/MyDB.accdb";
这篇关于无法连接到共享驱动器上的数据库 - UCanAccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!