Obtaining a JDBC Connection from a JDBC Adapter in a Java service

Hi -

I am writing some flow services that will read and update data in a set of databases. Each database has the same schema, and the logic to invoke against each database is the same. Instead of writing flow services that are tied to a specific adapter, and therefore having to clone these flow services for each database, I would prefer to have a single flow service that reads/updates the database, but decides which database to connect to based on the input data.

My goal here is to minimize the amount of cloned code that I have to maintain.

My thought is to have a java flow service that will obtain a JDBC connection from the JDBC adapter at the beginning of processing, then perform the necessary reads and updates to the database using the JDBC methods/classes.

I’ve done something similar before, but in that case I used some third-party open source classes to manage the JDBC connection pools. In this case I would prefer to have the webMethods JDBC adapter manage the connection pool for each database. I just need to be able to obtain a connection from the pool at the beginning of processing (and of course return it when I am finished).

Is this possible? Or does anyone have alternative suggestions on how I can minimize the amount of cloned code?


I forgot to mention that I am using webMethods Integration Server version 6.1.


Basically you can use this 6.1 service in WmART
pub.art.service:setAdapterServiceNodeConnection to change the JDBC connection name which connects to that particular database and branch on this service when decides which database to connect to based on the input data that you have mentioned.

This way you can make use on one insertService and update the database instead of cloned services with diff invokes with connection pooling.