CacheDriver
The driver class of a JDBC driver. The specified driver is used to connect to the target database for all caching operations.
Data Type
string
Default Value
""
Remarks
You can cache to any database for which you have a JDBC driver, including CData JDBC drivers.
Note: You must add the JAR file of the specified JDBC driver to the classpath. For CData JDBC drivers, you can find this JAR file in the "lib" subfolder of that driver's installation directory.
You must also set the CacheConnection connection property to provide a connection string for the specified JDBC driver.
For Linux systems and macOS, you need to create a config.ini file on the installation path of the driver (site-packages/cdata).
The config.ini file has the following format (the driver and the path of the JDBC driver):
[salesforce.cpython-38-x86_64-linux-gnu.so] CLASSPATH = /home/usrname/Downloads/lib/cdata.jdbc.postgresql.jar
Examples
The following examples show how to cache to several major databases. Refer to CacheConnection for more information on the JDBC URL syntax and typical connection properties.Derby and Java DB
Java DB is the Oracle distribution of Derby. You must add the Derby JDBC driver's JAR file, derbytools.jar, to your classpath to cache to Java DB.
The Derby JDBC driver's JAR file is bundled in db-derby-10.17.1.0-bin.zip, which you can download from this page. You can find derbytools.jar in the "lib" subfolder of this zip file.
After adding derbytools.jar to the classpath, you can cache to a Java DB database as follows:
jdbc:sapfieldglass:CacheDriver=org.apache.derby.jdbc.EmbeddedDriver;CacheConnection='jdbc:derby:sample';EnvironmentURL='https://myinstance.com';OAuthClientId=clientId;OAuthClientSecret=clientSecret;APIKey=xxxxxxxx-xxxx-xxxx-xxxx;To cache to an in-memory database, use a JDBC URL like the following:
jdbc:sapfieldglass:CacheDriver=org.apache.derby.jdbc.EmbeddedDriver;CacheConnection='jdbc:derby:memory';EnvironmentURL='https://myinstance.com';OAuthClientId=clientId;OAuthClientSecret=clientSecret;APIKey=xxxxxxxx-xxxx-xxxx-xxxx;
SQLite
The following is a JDBC URL for the SQLite JDBC driver:
jdbc:sapfieldglass:CacheDriver=org.sqlite.JDBC;CacheConnection='jdbc:sqlite:C:/Temp/sqlite.db';EnvironmentURL='https://myinstance.com';OAuthClientId=clientId;OAuthClientSecret=clientSecret;APIKey=xxxxxxxx-xxxx-xxxx-xxxx;
MySQL
The following is a JDBC URL for the CData JDBC Driver for MySQL:
jdbc:sapfieldglass:Cache Driver=cdata.jdbc.mysql.MySQLDriver;Cache Connection='jdbc:mysql:Server=localhost;Port=3306;Database=cache;User=root;Password=123456';EnvironmentURL='https://myinstance.com';OAuthClientId=clientId;OAuthClientSecret=clientSecret;APIKey=xxxxxxxx-xxxx-xxxx-xxxx;
SQL Server
The following JDBC URL uses the Microsoft JDBC Driver for SQL Server:
jdbc:sapfieldglass:Cache Driver=com.microsoft.sqlserver.jdbc.SQLServerDriver;Cache Connection='jdbc:sqlserver://localhost\sqlexpress:7437;user=sa;password=123456;databaseName=Cache';EnvironmentURL='https://myinstance.com';OAuthClientId=clientId;OAuthClientSecret=clientSecret;APIKey=xxxxxxxx-xxxx-xxxx-xxxx;
Oracle
The following is a JDBC URL for the Oracle Thin Client:
jdbc:sapfieldglass:Cache Driver=oracle.jdbc.OracleDriver;CacheConnection='jdbc:oracle:thin:scott/tiger@localhost:1521:orcldb';EnvironmentURL='https://myinstance.com';OAuthClientId=clientId;OAuthClientSecret=clientSecret;APIKey=xxxxxxxx-xxxx-xxxx-xxxx;
NOTE: If using a version of Oracle older than 9i, the cache driver will instead be oracle.jdbc.driver.OracleDriver .
PostgreSQL
The following JDBC URL uses the official PostgreSQL JDBC driver:
jdbc:sapfieldglass:CacheDriver=cdata.jdbc.postgresql.PostgreSQLDriver;CacheConnection='jdbc:postgresql:User=postgres;Password=admin;Database=postgres;Server=localhost;Port=5432;';EnvironmentURL='https://myinstance.com';OAuthClientId=clientId;OAuthClientSecret=clientSecret;APIKey=xxxxxxxx-xxxx-xxxx-xxxx;