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