Cagen Access JDBC Driver v4.0 Documentation


  1. Setting the CLASSPATH
  2. Loading the Driver
  3. Connecting to the Database
  4. Supported SQL Syntax
  5. Supported SQL Function

Setting the CLASSPATH

To put accessdriver.jar into your class path, you should use "export CLASSPATH=/usr/share/lib/accessdriver.jar:$CLASSPATH" on Solaris and Linux, and "SET CLASSPATH=\javalib\accessdriver.jar;%classpath%" on Windows.

Loading the Driver

Any source that uses JDBC needs to import the java.sql package by using " import java.sql.*;".

Caigen Access driver' name is com.caigen.sql.access.AccessDriver, and you can uses it without involving hard coding the driver into your code. You do this by setting the jdbc.drivers system property. For example, for command line apps you can use:
java -Djdbc.drivers=com.caigen.sql.access.AccessDriver yourApp
Then, the JVM upon startup will load the drivers automatically. Some applications (JBoss, Tomcat etc) support a .properties file which they use to save putting this on the command line.

The second method is the most common and involves you loading the driver yourself. It's simple:
From then on you can get connections from DriverManager.
Note: If Class.forName() throws ClassNotFoundException, you should check your classpath.

Data Source class is com.caigen.sql.CaigenDataSource, and Connection Pool Data Source class is com.caigen.sql.CaigenConnectionPoolDataSource.

Connecting to the Database

After the driver has been registered with the DriverManager, you can obtain a Connection instance that is connected to a particular database by calling DriverManager.getConnection(). With JDBC, a database is represented by a URL (Uniform Resource Locator).

                jdbc:access:[//]/[DatabasePath][?prop1=value1[;prop2=value2]] (You can omit that "//" characters sometimes)
                        For example:
                                "jdbc:access:/c:/data" for Windows driver
                                "jdbc:access:///c:/data" for Windows driver
                                "jdbc:access:////usr/data" for unix or linux
                                "jdbc:access://///" for UNC path
        Compressed Database:(.ZIP, .JAR, .GZ, .TAR, .BZ2, .TGZ, .TAR.GZ, .TAR.BZ2) 
                jdbc url format is the same as embedded url and remote url.
                        For example:
        Memory-only Database:
        URL Database:(http protocol, https protocol, ftp protocol)
                        For example:
                                "jdbc:access:" //Note: FTP site's user/password should be set in ftpURL, and cannot be set in JDBC connection property because user/password JDBC connection property belongs to server/client connection.
        SAMBA Database:(smb protocol)
                        For example:
                                "jdbc:access:smb://test1:123@" //Note: SAMBA user/password should be set in SMB url, and cannot be set in JDBC connection property because user/password JDBC connection property belongs to server/client connection.
	UNC path JDBC url:
                        For example:
	Free JDBC url:(Warning: only use it for special project)
                jdbc:access:/" or "jdbc:access:///". Then you can use some full UNC path names in SQL to visit anywhere where your Java VM has right to access.
                        For instance:
                                select * from \\amd2500\e$\accessfiles\test;
                                elect * from "\\amd2500\d$\accessiles".test;
                                select * from ".".test;

         Caigen Access supports seamlessly data mining on memory-only table, physical table, url table, compressed table, SAMBA table in a sql.

To connect, you need to get a Connection instance from JDBC. To do this, you use the DriverManager.getConnection() method:

Connection con = DriverManager.getConnection(url, properties);

There are a few different signatures for the getConnection() method. You should see the API documentation that comes with your JDK for more specific information on how to use them. You can specify additional properties to the JDBC driver by placing them in a java.util.Properties instance and passing that instance to the DriverManager when you connect.

Property Name
Default Value
user The user to connect as null
password The password to use when connecting null
lockTimeout To specify Access driver's timeout in milliseconds to wait until other processes or Access applications released record lock or table lock. 0 means a default value, and <0 means no wait. 1000
tmpdir Indicates whether set a temp directory, Default: the value of JVM's "" property. If that value is incorrect, uing the directory of JDBC url. _memory_ means large data in memory. null
delayedClose Indicates the delayed seconds for close transaction. That option is used to avoid frequent close/open table operations for following sqls. You can use 0~120 seconds. Default: 3. null
maxCacheSize Indicates the max memory utilization for per table on automatic temporary index or matched result cache. You can use 16~65536 kilo bytes. Default: 1024. null
versionNumber Access JET Version Number. You can use null, "JET3"(JET version 3.0), "JET4" (JET version 4.0), "JET5" (JET version 5.0).. This parameter is only used for CREATE DATABASE . JET4
ODBCTrimBehavior Indicates whether works like MS Access ODBC driver to ignore tail space characters in condition expression. You can use null, true, false true
caseInsensitive Indicates whether works like MS Access ODBC driver to be case insensitve for string comparison. You can use null, true, false false
otherExtension Indicates whether Access driver supports other extension beside 'MDB', 'MDE', 'ACCDB', 'ACCDE', and 'ACCDR'. You can use comma to assign more than one extension, for instance, otherExtension=DB,ACR . null

When your code then tries to open a Connection, and you get a No driver available SQLException being thrown, this is probably caused by the driver not being in the class path, or the JDBC url not being correct.

To close the database connection, simply call the close() method to the Connection:



Copyright © 2008-2019 Caigen Software. | All Rights Reserved. |