Microsoft SQL Server Database Installation and Configuration
If you are using Microsoft SQL Server, the information below will help you get set up.
You can also refer to the applicable section of the Install Guide: go to Installing the Akana API Platform, choose the version, and then search for the Database notes: Microsoft SQL Server section.
Table of Contents
- Downloading the Microsoft SQL Server Driver
- Certificate requirements
- Connection String Properties
- Changing the Akana Platform to use a MS SQL Server Driver
- MS SQL Server: Troubleshooting
Downloading the Microsoft SQL Server Driver
You can download the driver from the following URL:
https://www.microsoft.com/en-us/download/details.aspx?id=57782
File name after extracting from the .exe file:
mssql-jdbc-7.2.2.jre8.jar
Certificate requirements
The certificate requirements are:
- Certificate must be present in the Local computer certificate store or the current user certificate store.
- Certificate age must be present within the validity period.
- Certificate must be meant for server authentication. (EKU should specify Server Authentication [1.3.6.1.5.5.7.3.1])
- Certificate must be created using the KEY_SPEC option of AT_KEYEXCHANGE (KEY_SPEC=1)
- Common name of the certificate should be the host name or the FQDN of the server computer.
Connection String Properties
The connection string properties are:
- encrypt=true: Driver will encrypt.
- trustServerCertificate=true: Driver will not validate certificate and will always trust it.
- trustServerCertificate=false: Driver will validate SQL Server certificate against JVM default trust store or given trust material that is supplied at connection time by trustStore and trustStorePassword connection properties.
- trustStore=C:\akana\plat\akana-qa-35-sqlserver.jks: path, including filename, to the certificate trust store file.
- trustStorePassword=password: Password for the trust store.
- hostNameInCertificate=akana-qa-35: Host name as defined in the certificate.
Connection string properties: usage example
If the trustStore and trustStorePassword are defined as admin properties, the URL is constructed as shown in the example below.
jdbc:sqlserver://{server}:{port}/{database};user={user};password={password};trustStore={trustStore};trustStorePassword={trustStorePassword}
Additional information about connection string properties is available in this Microsoft article: https://docs.microsoft.com/en-us/sql/connect/jdbc/connecting-with-ssl-encryption?view=sql-server-2016.
Changing the Akana Platform to use a MS SQL Server Driver
Follow these procedures:
- Changing the Akana Platform to use the MS Driver: in all cases
- Configuring MS SQL Driver to use SSL Encryption: If you want to use encryption: complete the first procedure and then follow this one
Changing the Akana Platform to use the MS Driver
- Place the jre8 driver in the following directory: {install_dir}/instances/{instance}/deploy.
- Log in to the Akana Administration Console and go to Configuration > Settings.
- In the com.soa.database.config category, change the settings as follows:
- driver, old value: net.sourceforge.jtds.jdbc.Driver
- driver, new value: com.microsoft.sqlserver.jdbc.SQLServerDriver
- url, old value: jdbc:jtds:sqlserver://{server}:{port}/{database};user={user};password={password}
- url, new value: jdbc:sqlserver://{server}:{port}/{database};user={user};password={password}
- Restart the containers.
Configuring MS SQL Driver to use SSL Encryption
- Set up the platform to use Microsoft SQL driver, following the procedure above.
- Generate and register the server certificate with the SQL Server Configuration Manager. Follow the instructions in this link:
Note: There are several ways to create and register SSL certificates. This example uses one option, using the PowerShell command. For an example command, see Example PowerShell command to create certificate below.
- Restart SQL Server.
- To use encryption, one of the following two approaches in the connection string:
- Basic trust: encrypt=true;trustServerCertificate=true
- Verify Certificate: encrypt=true;trustServerCertificate=false;hostNameInCertificate=akana-qa-35
- Optional: If you chose to verify the certificate, use a tool such as Keystore Explorer to import the server certificate into the platform jre cacerts file.
- Start up the containers and verify that they connect.
Example PowerShell command to create certificate
Example command:
New-SelfSignedCertificate -DnsName akana-qa-35 -CertStoreLocation cert:\LocalMachine\My -friendlyName akana-qa-35 -KeySpec KeyExchange
MS SQL Server: Troubleshooting
Refer to the following troubleshooting information:
Issues with restarting Microsoft SQL Server
If you run into issues with restarting SQL Server, check the article below. You might need to change the user login for the SQL Server process in SQL Server Configuration Manager.