Configuring Non-XA DataSource Connection
Step 1: Run the SetupUtlity.jar
Run the SetupUtility.jar
For detailed instructions, see Setup.
Step 2: Configuring Context File
Navigate to the Apache Tomcat configuration directory and edit the context configuration file:
C:\Program Files\Apache Software Foundation\Tomcat 10.1\conf\context.xml
The Tomcat server configuration file using native JDBC drivers appears as follows:
<Resource name="jdbc/book"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.cj.jdbc.Driver"
url="jdbc:mysql://localhost:3306/databaseName"
maxIdle="10"
maxTotal="25"
/>
<Resource name="jdbc/student"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.cj.jdbc.Driver"
url="jdbc:mysql://localhost:3306/databaseName"
maxIdle="10"
maxTotal="25"
/>
Update the existing DataSource configuration to use the Delinea JDBC Driver:
<Resource name="jdbc/book"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.delinea.jdbc.DelineaDriver"
url="jdbc:delinea:mysql://localhost:3306/databaseName"
maxIdle="10"
maxTotal="25"
connectionProperties="
delinea_secretId=62;
delinea_vendorClass=com.mysql.cj.jdbc.Driver"
/>
<Resource name="jdbc/student"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.delinea.jdbc.DelineaDriver"
url="jdbc:delinea:oracle:thin:@//localhost:1521/XEPDB1"
maxIdle="10"
maxTotal="25"
connectionProperties="
delinea_secretId=61;
delinea_comment=Need DB credentials;
delinea_vendorClass=com.mysql.cj.jdbc.Driver"
/>
Configuration Properties
| Property | Description |
|---|---|
driverClassName
|
(Mandatory) Driver class name.
Value: com.delinea.jdbc.DelineaDriver |
url
|
(Mandatory) Connection URL.
Add the prefix delinea: after jdbc:.
|
delinea_secretId
|
(Mandatory) The secret ID that contains database credentials. |
delinea_vendorClass
|
(Mandatory) The vendor driver class used to retrieve the connection. |
delinea_comment
|
(Optional) Add this property only if autoComment is enabled on the secret. |
All delinea_* parameters must be defined in the
connectionProperties attribute.
Step 3: Configuring Application Configuration File
Navigate to the directory where the application is deployed:
C:\Program Files\Apache Software Foundation\Tomcat 10.1\conf\webapps
Edit the application configuration file. Depending on the application, the configuration
file format may vary (for example, .txt, .xml,
.properties, or .config).
The following example shows a Java JPA application configured with multiple Non XA data sources:
<persistence-unit name="PersistenceUnit1" transaction-type="RESOURCE_LOCAL">
<non-jta-data-source>java:comp/env/jdbc/book</non-jta-data-source>
<class>com.jpa.entity.Book</class>
</persistence-unit>
<persistence-unit name="PersistenceUnit2" transaction-type="RESOURCE_LOCAL">
<non-jta-data-source>java:comp/env/jdbc/student</non-jta-data-source>
<class>com.jpa.entity.Student</class>
</persistence-unit>
In this example, the application is configured with two Non XA data sources:
java:comp/env/jdbc/bookjava:comp/env/jdbc/student
- DataSource: Specifies the JNDI name of the database resource.
- Always add the prefix
java:comp/env/before the DataSource name. - Key names may vary depending on the application implementation.