Configure JNDI - Tomcat
For MySQL
How to Configure JNDI
- Copy the
mysql-connector-x-8.x.x.jarfrom theVoltMXFoundry_Plugins\resourcesfolder. - Paste the
mysql-connector-x-8.x.x.jarfile under user install directory inside theTomcat > Lib folder- for example,<User install directory>\apache-tomcat-9.x.x\lib.
How to Configure Data Source
- Create the authService.xml file in the
<User install directory>\apache-tomcat-9.x.x\conf\Catalina\localhostfolder. - In the authService.xml file, create two entries one for authglobaldb and the other for authconfig by using the following template:
<Resource auth="Container" driverClassName="<DB\_Driver>" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" initialSize="5" jmxEnabled="true" logAbandoned="true" maxActive="10" maxIdle="10" maxWait="10000" minEvictableIdleTimeMillis="30000" minIdle="5" name="<JNDI\_NAME>" password="<PWD>" removeAbandoned="true" removeAbandonedTimeout="600" testOnBorrow="true" testOnReturn="false" testWhileIdle="true" timeBetweenEvictionRunsMillis="30000" type="javax.sql.DataSource" url="<DB\_connection\_String>" username="<USER\_NAME>" validationInterval="30000" validationQuery="SELECT 1"/>
-
In the
authService.xmlfile, add the following data source configurations:In the following data source configurations, you must replace the following fields with appropriate values to access the database.
The following table details field names to be configured for data source:
| Field Name | Value |
|---|---|
| Database specific driver, i. MySQL: com.mysql.jdbc.Driverii. ORACLE: oracle.jdbc.driver.OracleDriveriii. MSSQL: com.microsoft.sqlserver.jdbc.SQLServerDriver |
|
| i. jdbc/authglobaldb ii. jdbc/authconfig |
|
<PWD> |
Database password |
<DB_connection_String> |
Database connection string, i. MySQL: jdbc:mysql://hostname:port/databaseName?autoReconnect=true&useSSL=falseii. ORACLE: jdbc:oracle:thin:@hostname:port Number:databaseNameiii. MSSQL: jdbc:sqlserver://DBHOSTIP[\DBINSTANCENAME]:PORT;databasename=DBNAME |
<USER_NAME> |
Database username. For example, root |
- Save the
authService.xmlfile.