Testing JDBC Connection when Installing Resource Instance
You can test the connection to the configured database when you install the JDBC resource instance on a node from the Administrator UI or CLI. If there is any issue in the configuration and connection test fails, the resource instance is in the Install Failed state.
Procedure
- Create a JDBC resource template using Administrator UI or CLI. For more information, refer
Creating a Resource Template. Sample
resourcetemplate_data.xml
file located at directory
<CONFIG_HOME>\admin\amxadmin\samples:
<ResourceTemplate xsi:type="amxdata:JdbcResourceTemplate" name="cliJdbcNonXaNoTx" description="jdbc non xa no tx" maxConnections="8888" disableValidateConnectionOnInit="false"> <Direct xsi:type="amxdata:Direct" dbUrl="jdbc:hsqldb:hsql://localhost:1234/jdbcRtDb" jdbcDriver="org.hsqldb.jdbcDriver" isTransactional="false" loginTimeOut="2"/> <connection-property xsi:type="amxdata:Property" name="Property1" value="propertyValue1"/> <connection-property xsi:type="amxdata:Property" name="Property2" value="propertyValue2"/> <connection-property xsi:type="amxdata:Property" name="Property3" value="propertyValue3"/> <hostTypeProperties xsi:type="amxdata:Properties"> <Property xsi:type="amxdata:Property" name="hostProp1" value="val1"/> <Property xsi:type="amxdata:Property" name="hostProp2" value="val2"/> </hostTypeProperties> <InlineCredentials username="cliJdbc" password="cliTiger"/> </ResourceTemplate>
- Create and install the JDBC resource instance using Administrator UI or CLI. For more information, refer
Installing Resource Instances on Nodes. A test connection will be made to the configured database. If there is any issue in the database configuration, resource instance will be in the
Install Failed state and error will be displayed in the Administrator UI and in node logs:
Sample Node Logs:
If the connection test to JDBC resource fails, the error message is recorded in node logs as shown in the following sample node logs:
Action: Install resource instance 'JDBC' failed Node: SystemHost:DevNode Causes: JDBC Test Connection failed during data source init, Exception:SOO10 invalid argument in JDBC call
If the connection test to JDBC resource is successful, the following log message is displayed in node log file using logger com.tibco.amx.ra.jdbcxa.[INFO ] [] com.tibco.amx.ra.jdbcxa - TIBCO-AMX-SR-JDBC-013124: Successfully created DataSource using Driver: oracle.jdbc.OracleDriver
- By default, testing connection to a JDBC resource is enabled in ActiveMatrix Administrator. To disable the feature set the Java property
com.tibco.admin.jdbc.disable.validate.connection.oninit to
true in the ActiveMatrix System Node’s TRA file. System Node’s TRA file is located at
CONFIG_HOME\tibcohost\<instance_name>\data_3.2.x\nodes\SystemNode\bin\
directory.
java.property.com.tibco.admin.jdbc.disable.validate.connection.oninit=true
- Alternatively, when creating the resource template, set the attribute
disableValidateConnectionOnInit to
true in the
<CONFIG_HOME>\admin\amxadmin\samples\resourcetemplate_data.xml file.
Sample resourcetemplate_data.xml:
<ResourceTemplate xsi:type="amxdata:JdbcResourceTemplate" name="cliJdbcNonXaNoTx" description="jdbc non xa no tx" maxConnections="8888" disableValidateConnectionOnInit="true"> <Direct xsi:type="amxdata:Direct" dbUrl="jdbc:hsqldb:hsql://localhost:1234/jdbcRtDb" jdbcDriver="org.hsqldb.jdbcDriver" isTransactional="false" loginTimeOut="2"/> <connection-property xsi:type="amxdata:Property" name="Property1" value="propertyValue1"/> <connection-property xsi:type="amxdata:Property" name="Property2" value="propertyValue2"/> <connection-property xsi:type="amxdata:Property" name="Property3" value="propertyValue3"/> <hostTypeProperties xsi:type="amxdata:Properties"> <Property xsi:type="amxdata:Property" name="hostProp1" value="val1"/> <Property xsi:type="amxdata:Property" name="hostProp2" value="val2"/> </hostTypeProperties> <InlineCredentials username="cliJdbc" password="cliTiger"/> </ResourceTemplate>
If the test connection to JDBC resource feature is disabled when creating resource template and if you enable it when creating the resource instance, the feature is not enabled for the resource template, which is already created. The feature is enabled for the resource template and resource instance created after enabling the feature.