Create a SQL Server JNDI data source on Tomcat
Procedure
-
Browse to the appropriate directory for your Java version, under
PolicyCenter/admin/lib.
Option Description Java 8 PolicyCenter/admin/lib/java8 Java 11 PolicyCenter/admin/lib/java11 -
Copy the mssql-jdbc-<version>.jar
JAR file to the Tomcat lib directory.
This JAR file contains the APIs for connecting to the PolicyCenter database.
-
Add a
Resourceentry to the context.xml file in the conf directory of the Tomcat instance. If the context.xml file does not exist, create it.The
Resourceelement must be a child of the top-levelContextelement. The resourcenameattribute must match thedatasource-nameattribute of thejndi-connection-poolelement in database-config.xml, for example:<Resource name="jdbc/pcDataSource" auth="Container" type="javax.sql.DataSource" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://database server name:database server port;selectMethod=direct; databaseName=database name;sendStringParametersAsUnicode=false;user=database user; password=database password" username="database user" password="database password" maxTotal="20" maxIdle="10" maxWaitMillis="-1"/> -
Add a
resource-refentry to the web.xml file in the conf directory of the Tomcat instance, for example:<resource-ref> <description>SQL Server Datasource</description> <res-ref-name>jdbc/Datasource name</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> - Restart the Tomcat instance.
