JDBC Adapter for PostGreSQL

I’m trying to use JDBC Adapter for PostGre SQL. I download the driver on :
https://jdbc.postgresql.org/download.html

I want use the PostgreSQL JDBC 4.2 Driver, 42.2.14 file.

First of all, I’m always lost to put the file in the good place. I copy and past the file on the following folders (without knowing the good one) :

  • \IntegrationServer\packages\WmJDBCAdapter\code\jars\static
  • \IntegrationServer\instances\default\packages\WmJDBCAdapter\code\jars
  • \IntegrationServer\instances\default\packages\WmJDBCAdapter\code\jars\static
  • \IntegrationServer\instances\default\lib\jars\custom

And after that I refresh tje JDBC Adapter package.

According to the JDBC Adapters documentation I use the org.postgresql.ds.PGSimpleDataSource source class.

But when I try to connect, I have the following error :

[ADA.1.200] The JDBC DataSource class “org.postgresql.ds.PGSimpleDataSource” cannot be located.
org.postgresql.ds.PGSimpleDataSource

What I miss ?

Thanks for your reply

Hi Vital,

Please place jar under \IntegrationServer\instances\default\lib\jars\custom. This is the recommended place as during migration, it will pick jars from this location to the new installation. Once you place the jars in this folder, restart of IS is required for classes to be visible in IS.

Regards,
-Kalpesh.

Hello,

I would prefer of having it here:
\IntegrationServer\instances\default\packages\WmJDBCAdapter\code\jars

And if you want it automatically to be provided to newly generated instances here:
\IntegrationServer\packages\WmJDBCAdapter\code\jars

In this case a reload of the package WmJDBCAdapter is sufficient to enable new versions of the jars.

static folder is only needed when the jars have a native part (a dll or shared lib) which should be located under \IntegrationServer\lib and \IntegrationServer\instances\default\lib
In this case a restart of IS is required to activate the new versions of the jars and libs.

When placing the jar under lib\jars\custom it is visible to the whole IntegrationServer, when placing under packages\WmJDBCAdapter\code\jars, it will only be visible to JDBC Adapter itself and packages which are marked to be dependent on WmJDBCAdapter package.

Regards,
Holger

Thanks Holger,
It’s clear but when I try it doesn’t work but I refresh the JDBCAdapter Package

It should be avoided to have the same jar at different locations of the same instance as this might cause class loading issues when they have different versions of the same class.

Which JDBC Adapter are you using and which Fix is applied to it?

Hi Holger,
The exact message is
org.postgresql.Driver cannot be cast to javax.sql.DataSource

JDBC 10.3 FIX 9 for IS 10.5 Java 1.8.0_242 (52.0)

And I tried Driver
postgresql-42.2.14

Hi Vital,
webMethods adapter system requirement document says -PostgreSQL jar file postgresql-42.2.5.jar is required in the classpath for 10.3 JDBC adapter

Can you try with this jar version for postgresql connectivity?

Hi Vital,

Follow below steps,

  1. Place your driver jar under below folder and remove from other places
    \IntegrationServer\instances\default\packages\WmJDBCAdapter\code\jars
  2. restart Integration Server
  3. Create adapter connection with below configurations
    1. DataSource : org.postgresql.ds.PGSimpleDataSource
    2. Fill in your DB details for server name, user,password,database name and port
    3. save changes
      4)Enable Connection.
1 Like

Hello Alphonse,
I tried with version postgresql-42.2.5.jar with data source org.postgresql.Driver and I have still same error :
org.postgresql.Driver cannot be cast to javax.sql.DataSource

Hi Mansoor,

  1. I did it
  2. Accourding to what Holger said to me (and after trying), it is not necessary, Reloadng package WMJDBCAdapter is enough. (Even I can see, if I do that, Adapter Connection are disabled and after enable them, I have some strange behaviour).
  3. I use DataSource : org.postresql.Driver according to the editor doc.

But I have the same error

Sorry Mansoor,
It’s work : it’s juste the “ds” between org.postgresql.ds.PGSimpleDataSource I didn’t saw in source class

2 Likes

Hi All,

I am trying to configure JDBC adapter for postgre connectivity.

I have downloaded the jar and placed it in /webm/IntegrationServer/instances/default/lib/jars/postgresql-42.2.16.jar and my
connection parameters are

Transaction Type - LOCAL_TRANSACTION
DataSource Class - org.postgresql.ds.PGSimpleDataSource
Network Protocol - tcp
Other Properties - driverType=thin

When I am saving this details and enabling the connection I am getting the error as

[ART.118.5063] Adapter Runtime (Connection): Unable to start connection abhijith:testpostgre: after 1 attempt(s).
[ADA.1.204] Cannot connect to the database with DataSource class “org.postgresql.ds.PGSimpleDataSource”.
The connection attempt failed.

Am I missing anything. I have restarted the server too after placing the jar file.

Hi Abhijith.

the jar should go to /webm/IntegrationServer/instances/default/packages/WmJDBCAdapter/code/jars.
Any PostgreSQL jar under /webm/IntegrationServer/instances/default/lib/jars/ can be removed.
Restart the IS once more and for next updates of the jat it is enough to just reload the WmJDBCAdapter package.

I think that driverType=thin is limited to Oracle databases.

There should be a more detailed error message why starting the connection fails.
The error message does not contain any informations about that.

Regards,
Holger

Hi Holger

Thank you for your reply. I have two test environments in one of them i placed in intergration/libljars and in another environment i have removed the jars from lib/jars and placed in WmJDBCAdapter and reloaded the package too.

I am getting the same error which i have mentioned above. There is no specific error written anywhere other than connection not established.

coming to driverType=Thin i have removed that and tried with jdbc:postgre and the error is still the same

Hi Abijith,

please check your connection configuration if there are any leading/trailing spaces in the fields.

Did you check the wrapper.log of IS or the Database logs if there is any information about the connection attempt?
Additionally you can try to tweak the logging settings of ART and JDBC Adapter to see if there will be some more helpful information then.

Regards,
Holger

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.