Basic Configuration

Version 25.3.9411


Basic Configuration


Basic configuration settings are controlled from the apiserver.properties file. The following is an example of the file’s contents:

; ---------------------------------------
; ${cdata.home} is the installation directory.
; ---------------------------------------

cdata.contextPath=/

; The connection string to use for an external database to be used as the Application Database. When unspecified, the application will default to a derby database within Application Directory.
cdata.app.db=
; The path on disk to use as Application Directory. Use '/' character as a Path separator regardless of the Operating system.
cdata.app.directory=

;; HTTP
cdata.http.port=8080

;; TLS
cdata.tls.port=
cdata.tls.keyStoreType=
cdata.tls.keyStorePath=
cdata.tls.keyStorePassword=

;; Request log
cdata.requestLog.enabled=false
cdata.requestLog.filenameDateFormat=yyyy_MM_dd
cdata.requestLog.retainDays=90

Submit the following command in the installation directory (InstallationDirectory) where the apiserver.jar file is located. This generates the apiserver.properties file:

java -jar apiserver.jar -GenerateProperties

Configuring the Application Directory

The CData API Server ApplicationDirectory contains all the data that is used by the application. To change this directory in apiserver.properties, enter the directory after cdata.app.directory=. Use / as a path separator.

Configuring the Application Database

The CData API Server application database stores application data. The default value is a Derby database that resides in ApplicationDirectory. However, you can configure the application to use an enterprise database like MySQL. To change the external database in apiserver.properties, enter the database connection string after cdata.app.db=. For example, the following is a connection string for MySQL:

cdata.app.db=jdbc:cdata:mysql:server=localhost;port=3306;database=mysql;user=MyUserName;password=MyPassword

Changing the Port

To configure the port on which the embedded server listens:

  1. In apiserver.properties, locate the following line where the port is set:
    cdata.http.port=8080.
    
  2. Change this value to the port number you want.

Enabling TLS

To enable TLS connections (HTTPS), you also need to modify the apiserver.properties file in InstallationDirectory, as follows:

  1. Set the cdata.tls.port setting to the port that should be used to host the server.

  2. Set the cdata.tls.keyStoreType setting to the type of keystore that will be used. Valid values include JKS, PKCS12, and JCEKS.

  3. Set the cdata.tls.keyStorePath setting to the path of the keystore that will be used. Note that ${cdata.home} might be used to refer to InstallationDirectory.

  4. Set the cdata.tls.keyStorePassword setting to the password for the keystore.

The final result should look similar to the following:

;; HTTP
cdata.http.port=

;; TLS
cdata.tls.port=8443
cdata.tls.keyStoreType=PKCS12
cdata.tls.keyStorePath=${cdata.home}/mycertificate.pfx
cdata.tls.keyStorePassword=MyPassword

Enabling Logging

To enable logging in the apiserver.properties file, enter true after cdata.requestLog.enabled=. The default value is false (disable logging).