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

Announcements
Join us in Zurich on Sept 24th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] JDBC connection pool to AS400

Hello All,
I am trying to create jdbc connection pool to AS400 db in talend runtime. My datasouce configuration file looks as follows and it deploys fine in runtime:
<bean id="poolDataSource" class="com.ibm.as400.access.AS400JDBCConnectionPoolDataSource">
    <property name="serverName" value="XXX"/>
    <property name="user" value="XXX"/>
    <property name="password" value="XXX"/>
  </bean>
 
  <bean id="dataSource"
        class="com.ibm.as400.access.AS400JDBCConnectionPool" destroy-method="close">
        <property name="dataSource" ref="poolDataSource" />
        <property name="maxConnections" value="3" />
       
    </bean>
 
  <service ref="dataSource" auto-export="class-hierarchy">
    <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc-as400CPds"/>
    </service-properties>
  </service>
The reason I have to do it this way is because AS400JDBCConnectionPoolDataSource does not handle connection pool functionality (for example, I cannot set number of connections). AS400 jar has its own connection pool class: AS400JDBCConnectionPool which unfortunately does not implement javax.sql.DataSource interface, although it has both required getConnection methods. That's why I try to expose this service under its own class. Unfortunately it seems that my talend job does not like this setup. When I run it, in the log file I see this line: Bundle local_project1.RestWSPrototype3 is waiting for dependencies . Can I somehow configure my job to look for objectClass = AS400JDBCConnectionPool rather then DataSource? Any other advice on how I can setup jdbc connection pool to AS400?
Thank you!
Svetlana

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

OK, solved it! In case anybody interested, I used apache connection pool: org.apache.tomcat.jdbc.pool.DataSource. So my final configuration is:
<bean id="as400poolDS" class="com.ibm.as400.access.AS400JDBCConnectionPoolDataSource">
    <property name="serverName" value="XXX"/>
    <property name="user" value="XXX"/>
    <property name="password" value="XXX"/>
  </bean>
 
 
  <bean id="dataSource"
        class="org.apache.tomcat.jdbc.pool.DataSource" >
        <property name="dataSource" ref="as400poolDS" />
       
        <property name="initialSize" value="2" />
        <property name="maxActive" value="3" />
       
    </bean>
 
  <service ref="dataSource" interface="javax.sql.DataSource">
    <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc-as400CPds"/>
    </service-properties>
  </service>

View solution in original post

2 Replies
Anonymous
Not applicable
Author

OK, solved it! In case anybody interested, I used apache connection pool: org.apache.tomcat.jdbc.pool.DataSource. So my final configuration is:
<bean id="as400poolDS" class="com.ibm.as400.access.AS400JDBCConnectionPoolDataSource">
    <property name="serverName" value="XXX"/>
    <property name="user" value="XXX"/>
    <property name="password" value="XXX"/>
  </bean>
 
 
  <bean id="dataSource"
        class="org.apache.tomcat.jdbc.pool.DataSource" >
        <property name="dataSource" ref="as400poolDS" />
       
        <property name="initialSize" value="2" />
        <property name="maxActive" value="3" />
       
    </bean>
 
  <service ref="dataSource" interface="javax.sql.DataSource">
    <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc-as400CPds"/>
    </service-properties>
  </service>
Anonymous
Not applicable
Author

Hi zvers,
Thanks for posting that you resolved it by yourself and sharing your solution with us.

Best regards
Sabrina