The connection string for the cache database. This property is always used in conjunction with CacheProvider . Setting both properties will override the value set for CacheLocation for caching data.
The cache database is determined based on the CacheDriver and CacheConnection properties. Both properties are required to use the cache database. Examples of common cache database settings can be found below. For more information on setting the caching database's driver, refer to CacheDriver.
The connection string specified in the CacheConnection property is passed directly to the underlying CacheDriver. Consult the documentation for the specific JDBC driver for more information on the available properties. Make sure to include the JDBC driver in your application's classpath.
Derby and Java DB
The connector simplifies caching to Derby, only requiring you to set the CacheLocation property to make a basic connection.
Alternatively, you can configure the connection to Derby manually using CacheDriver and CacheConnection. The following is the Derby JDBC URL syntax:
jdbc:derby:[subsubprotocol:][databaseName][;attribute=value[;attribute=value] ... ]For example, to cache to an in-memory database, use the following:
To cache to SQLite, you can use the SQLite JDBC driver. The following is the syntax of the JDBC URL:
- Data Source: The path to an SQLite database file. Or, use a value of :memory to cache in memory.
The installation includes the CData JDBC Driver for MySQL. The following is an example JDBC URL:
jdbc:mysql:User=root;Password=root;Server=localhost;Port=3306;Database=cacheThe following are typical connection properties:
- Server: The IP address or domain name of the server you want to connect to.
- Port: The port that the server is running on.
- User: The user name provided for authentication to the database.
- Password: The password provided for authentication to the database.
- Database: The name of the database.
The JDBC URL for the Microsoft JDBC Driver for SQL Server has the following syntax:
jdbc:sqlserver://[serverName[\instance][:port]][;database=databaseName][;property=value[;property=value] ... ]For example:
jdbc:sqlserver://localhost\sqlexpress:1433;integratedSecurity=trueThe following are typical SQL Server connection properties:
- Server: The name or network address of the computer running SQL Server. To connect to a named instance instead of the default instance, this property can be used to specify the host name and the instance, separated by a backslash.
- Port: The port SQL Server is running on.
- Database: The name of the SQL Server database.
- Integrated Security: Set this option to true to use the current Windows account for authentication. Set this option to false if you are setting the User and Password in the connection.
To use integrated security, you will also need to add sqljdbc_auth.dll to a folder on the Windows system path. This file is located in the auth subfolder of the Microsoft JDBC Driver for SQL Server installation. The bitness of the assembly must match the bitness of your JVM.
- User ID: The user name provided for authentication with SQL Server. This property is only needed if you are not using integrated security.
- Password: The password provided for authentication with SQL Server. This property is only needed if you are not using integrated security.
The following is the conventional JDBC URL syntax for the Oracle JDBC Thin driver:
jdbc:oracle:thin:scott/tiger@myhost:1521:orclThe following are typical connection properties:
Data Source: The connect descriptor that identifies the Oracle database. This can be a TNS connect descriptor, an Oracle Net Services name that resolves to a connect descriptor, or, after version 11g, an Easy Connect naming (the host name of the Oracle server with an optional port and service name).
- Password: The password provided for authentication with the Oracle database.
- User Id: The user Id provided for authentication with the Oracle database.
The following is the JDBC URL syntax for the official PostgreSQL JDBC driver:
jdbc:postgresql:[//[host[:port]]/]database[[?option=value][[&option=value][&option=value] ... ]]For example, the following connection string connects to a database on the default host (localhost) and port (5432):
jdbc:postgresql:postgresThe following are typical connection properties:
- Host: The address of the server hosting the PostgreSQL database.
- Port: The port used to connect to the server hosting the PostgreSQL database.
- Database: The name of the database.
- User name: The user Id provided for authentication with the PostgreSQL database. You can specify this in the JDBC URL with the "user" parameter.
- Password: The password provided for authentication with the PostgreSQL database.