Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Capture Information From Data Source XML File

Hi,
I have the data source XML file (End of this message) in my Talend runtime/deploy folder on my server and it is referred to by the tJDBCConnection component (By checking "Specify a data source alias" and giving the above bean id as the "Data source alias" - please see screenshot below) of my service that is deployed on Talend Runtime.
If the service encounters any errror then it sends an error message using the error handling mechanism I have in place.
The error message contains information regarding job version, payload etc.
I wanted to know if it is possible to capture the information from the property tag with name = url (<property name="url" value="jdbc:sqlserver://Server1:1433;instanceName=Server1;databaseName=OneDB;schema=mySchema;"/>) when the job is executed.
I tried checking "tStatCatcher Statistics" in the Advanced settings tab of tJDBCConnection component but that does not provide information on which server, port, database or schema the tJDBCConnection component is using for connection pooling.
I would greatly appreciate your advice on how to achieve the above.
Data source XML file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" http://www.springframework.org/schema/beans"
  xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
  xmlns 0683p000009MA5A.pngsgi=" http://www.springframework.org/schema/osgi"
  xmlns:context=" http://www.springframework.org/schema/context"
  xsi:schemaLocation=" http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://camel.apache.org/chema/spring  http://camel.apache.org/schema/spring/camel-spring.xsd
       http://www.springframework.org/schema/osgi  http://www.springframework.org/schema/osgi/spring-osgi.xsd
   http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="jdbcOne" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
      <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
  <property name="url" value="jdbc:sqlserver://Server1:3333;instanceName=Server1;databaseName=OneDB;schema=mySchema;"/>
                  <property name="username" value="user"/>
                  <property name="password" value="pass"/>
                  <property name="initialSize" value="10"/>
                  <property name="maxActive"  value="50"/>
                  <property name="maxIdle" value="10"/>
                  <property name="maxWait" value="0"/>
  </bean>
  <osgi:service interface="javax.sql.DataSource" ref="jdbcOne">
    <osgi:service-properties>
            <entry key="osgi.jndi.service.name" value="jdbcOne"/>
    </osgi:service-properties>
  </osgi:service>
</beans>
In tJDBCConnection component Basic tab:
0683p000009MARN.png
Thanks
Labels (6)
2 Replies
Anonymous
Not applicable
Author

I would read in this file with a tFileInputXML, set these values with a tJavaRow to context variables and use the context variable to configure the database connection.
The JNDI (container managed database connection) access works only if you deploy the job into a Talend runtime or as war file (webapp). 
Anonymous
Not applicable
Author

Thanks jlolling.
I need to use the JNDI (container managed database connection) as my job is deployed in Talend runtime.
I may change the details within a bean in the Data Source XML file e.g. the database name and therefore I need to find a way to capture information from a bean's (that the tJDBCConnection component is pointing to) property tag with name = url (<property name="url" value="jdbc:sqlserver://Server1:1433;instanceName=Server1;databaseName=OneDB;schema=mySchema;"/>)in the Data Source file whenever my job encounters an error and then save that in a context variable so that the information can be sent as part of the error message to our error queue.
Thanks