Getting DB Connection object


Is there any built-in service in WM 6.0 which returns a DB connection object by just providing Adapter Alias name and Type (Without specifying user, pwd, dburl)?


Sure - all the db services give you the option of providing just the dbAlias OR all the connection parameters (url, username, password, driver), etc. The main point of the alias in my mind is to avoid have to enter all that stuff each time you want to connect. See the Built-in services guide for more info.

Will Kriski

Thanks Will…
But all the DB services are deprecated and in the JDBCAdapter there is no service which gives the connection object for dbAlias.


Sorry about that - I’m going to look at the docs tonight. Instead of a flow service you create an adapter service and pick the db alias you want to use. So you create an alias ahead of time like in 4.6 then the adapter service wizard asks you for the alias you want. Doesn’t look like you need a connection anymore…but I’ll have to read more.

As Will said, when defining the JDBC adapter, you choose which connection you would like to use for the adapter. However, I don’t think there is any way of changing the connection the adapter works on short of deleting the adapter and creating a new one, which I find unflexible.

I have no idea how to get the connection object in a custom java service. Unless anyone else knows this, you’ll need to provide url, user, pwd like you do now, which unfortunately means you have (at least) two places to update connection information if the database moves.

The best way is to bend the adapters to your will and avoid custom JDBC services, if at all possible. If you really do need to customize, send me a mail and I can give you a small tool class I created pre-WM for managing database connections so you only need to enter the connection information once.

Hi Brigt Vik,

I have the same problem with database connection… and with connection pooling with informix 7.31
Could you pass on the tool class u mentioned.