Basic Configuration
Version 25.3.9411
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:
- In apiserver.properties, locate the following line where the port is set:
cdata.http.port=8080. - 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:
-
Set the
cdata.tls.portsetting to the port that should be used to host the server. -
Set the
cdata.tls.keyStoreTypesetting to the type of keystore that will be used. Valid values includeJKS,PKCS12, andJCEKS. -
Set the
cdata.tls.keyStorePathsetting to the path of the keystore that will be used. Note that ${cdata.home} might be used to refer to InstallationDirectory. -
Set the
cdata.tls.keyStorePasswordsetting 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).