Testing a Connection to a JDBC Resource

You can test the connection to the configured database when you install the JDBC resource instance on a node using Administrator UI or CLI. If there is any issue in the configuration and connection test fails, the resource instance will be in the Install Failed state. Using this feature you can verify if there is any database configuration error before application using JDBC resource instance attempts the JDBC connection.

Procedure

  1. 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>
  2. 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