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
The following table lists the Delinea JDBC driver configuration properties.
The property names are case-sensitive and must be specified exactly as shown.
Database-Specific Configuration
-
For databases such as MySQL, Oracle, MariaDB, SQLite, and H2:
These drivers support URL-based configuration. Additional connection properties are not required. Add the following properties.
| Property | Description |
|---|---|
delinea_secretId
(Mandatory) |
The secret ID that contains database credentials. |
delinea_vendorClass
(Mandatory) |
The wrapped Non-XA datasource class.
Examples:
|
delinea_comment
(Optional) |
If autoComment is enabled on the secret, then add this property. |
| URL (Mandatory) | The connection URL. URL to the database. |
All delinea_* parameters and URL must be defined in the connectionProperties attribute.
-
For JDBC drivers such as Microsoft SQL Server, PostgreSQL, DB2, Derby, and Sybase:
These drivers do not support URL-only configuration. Additional properties must be explicitly defined.
| Property | Description |
|---|---|
delinea_secretId
(Mandatory) |
The secret ID that contains database credentials. |
delinea_vendorClass
(Mandatory) |
The wrapped Non-XA datasource class.
Examples:
|
delinea_comment
(Optional) |
If autoComment is enabled on the secret, then add this property. |
All delinea_* parameters and URL must be defined in the connectionProperties attribute.
Define the properties directly within the resource configuration as shown below:
<Resource name="jdbc/student"
auth="Container"
type="javax.sql.XADataSource"
factory="com.delinea.jdbc.DelineaXADataSourceFactory"
serverName="localhost"
portNumber="3306"
databaseName="databaseName"
maxIdle="10"
maxTotal="25"
connectionProperties="
delinea_vendorClass=oracle.jdbc.xa.client.OracleXADataSource";
delinea_secretId=61;
delinea_comment=Need DB credentials;
/>
| Property | Description |
|---|---|
serverName
(Mandatory)
|
Specifies the hostname or IP address of the database server to which the JDBC driver should connect. |
portNumber
(Mandatory) |
Specifies the port on which the database server is listening for incoming connections. |
databaseName
(Mandatory) |
Specifies the name of the target database/schema that the application should connect to. |
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.