///////////////////////////////////////////////////////////////////////////////////////////
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection conn=DriverManager.getConnection("jdbc:ucanaccess://<mdb or accdb file path>",user, password);
or
Connection conn=DriverManager.getConnection("jdbc:ucanaccess://<mdb or accdb file path>");
///////////////////////////////////////////////////////////////////////////////////////////
Driver Properties(驱动参数)
Memory(是否在内存操作,默认Ture): set if hsqldb will work only in memory. Default=true.
Newdatabaseversion(如果路径文件不存在将自动设置版本的数据库文件,默认不配置): UCanAccess create a new access file in the specified version if this parameter is setted and the file specified in the jdbc url does not exist.
Valid values for this parameter are: V2000, V2003, V2007, V2010.
Lockmdb(锁定数据库文件,默认False): if lockmdb is enabled (lockmdb=true), Ucanaccess locks the mdb file to prevent access from other processes. Default=false.
Showschema: if true, catalog "PUBLIC" and schema "PUBLIC" and others hsqldb schemas are shown in the DatabaseMetadata implementation. Default=false. Using showschema=true is raccomanded with Squirrel.
InactivityTimeout (since UcanAccess 0.1.1): it is used only with the default memory mode (Memory=true). If there are no active connections for the inactivityTimeout period (in minutes) hsqldb will be temporarily shutted down and also the filesystem resources will be released. It will be restarted at the next connection. Setting InactivityTimeout=0 can be used for avoiding this behavior. Default=2 minutes.
SingleConnection(since UcanAccess 1.0.0): it is used for for etl job, scheduled tasks or "one-shot" use of UCanAccess with only one connection open. All resources (memory and filesystem) will be released at the closing of the connection. Default=false.
Encrypt(since UcanaAccess 1.0.4): it allows hsqldb files encryption. You can use it in conjunction with Memory=false. Default=false.
Sysschema(since UcanaAccess 1.0.4):If true the msaccess system tables will be loaded in the "sys" readonly schema. Default=false.
Ignorecase: Disables (ignorecase = true) or enables (ignorecase = false) the case sensitivity of text comparison. Default=true.
for example:
Connection conn=DriverManager.getConnection("jdbc:ucanaccess://c:/pippo.mdb;lockmdb=true;ignorecase=true");
////////////////////////////////////////////////////////////////////////////////////////////
More Information
http://ucanaccess.sourceforge.net
- 1
- 2
- 3
- 4
- 5
前往页