CacheConnection
The connection string for the specified cache database.
Data Type
string
Default Value
""
Remarks
The target cache database is determined by a combination of this connection property and the CacheDriver connection property. Both properties are required to use the specified cache database.
The connection string specified in this connection property is passed directly to the JDBC driver specified in the CacheDriver connection property. Consult the documentation for the specified JDBC driver for more information on its available connection properties.
Make sure to include the JDBC driver you specified in CacheDriver in your application's classpath.
Examples of common cache database settings can be found below.
Derby and Java DB
Configure the connection to Derby using CacheDriver and this connection property. 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:
jdbc:derby:memory
SQLite
To cache to SQLite, you can use the SQLite JDBC driver. The following is the syntax of the JDBC URL:
jdbc:sqlite:dataSource
- Data Source: The path to an SQLite database file. Or, use a value of :memory to cache in memory.
MySQL
The following is an example JDBC URL for the CData JDBC Driver for MySQL:
jdbc:mysql:User=root;Password=root;Server=localhost;Port=3306;Database=cache
The following are typical connection properties:
- Server: The IP address or domain name of the server hosting the MySQL database that you want to cache to.
- Port: The port on the specified server where your MySQL instance is running.
- Database: The name of the MySQL database that you want to cache to. Must match the name of a MySQL database hosted on the specified server.
- User: The username of a user registered with the selected MySQL database.
- Password: The password associated with the specified MySQL user.
SQL Server
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=true
The 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, specify the host name and the instance name, separated by a backslash.
- Port: The port on the specified server where your SQL Server instance is running.
- Database: The name of the SQL Server database you want to cache to. Must match the name of a SQL Server database hosted on the specified server.
- Integrated Security: Set this option to True to use the current Windows account for authentication. Set this option to False to instead authenticate with User and Password.
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 username of a user registered with the selected SQL Server database. This property is only needed if you are not using integrated security.
- Password: The password associated with the specified SQL Server user. This property is only needed if you are not using integrated security.
Oracle
The following is the conventional JDBC URL syntax for the Oracle JDBC Thin driver:
jdbc:oracle:thin:[userId/password]@[//]host[[:port][:sid]]
For example:
jdbc:oracle:thin:scott/tiger@myhost:1521:orcl
The 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).
- User Id: The username of a user registered with the selected Oracle database.
- Password: The password associated with the specified Oracle user.
PostgreSQL
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:postgres
The following are typical connection properties:
- Host: The address of the server hosting the PostgreSQL database.
- Port: The port on the specified host server where your PostgreSQL database is hosted.
- Database: The name of the PostgreSQL database you want to cache to. Must match the name of a PostgreSQL database hosted on the specified server.
- User name: The username of a user registered with the selected PostgreSQL database. You can specify this in the JDBC URL with the "user" parameter.
- Password: The password associated with the specified user.