Trying to connect to database with java service

What product/components do you use and which version/fix level?

Is 10.5

Are you using a free trial or a product with a customer license?

I have a license

What are trying to achieve? Please describe in detail.

Im trying to connect a database with java service. Im trying this because a normal adapter connection was not create successfully. That post is this: How configure a JDBC Connection for Netezza IBM? - #2 by Sreekanth_Siddapur_Channakeshava

So, now Im trying to do that connection with java service but im getting error on Class.forName line. Its appears jar is unrecognize by code. Ive added the jar on build path.
image

this jar is in softwareag/IntegrationServer/instances/default/ packages/WmJDBCAdapter/code/jars too

image

Why my code did not recognize that driver?

Hi @Jesus_Carrillo1 ,

As I understand, there are 2 things that you are trying to do here.

  1. You are writing a Java Service in IS using the Netezza jar and trying to connect to the server via this service. The configuration you have done is straightforward and should have found the requested class in the classpath. Do please check if there is anything you are missing as far as the name of the class is concerned that you are trying to access. After adding the jar to the /lib or code/jars please try reloading the package. Did you try restarting the server?

  2. You are also trying to configure a DB connection using the WmJDBCAdapter package. And as @Suresh_Ganta mentioned, this is not supported I guess.

I quickly tried a custom jar adding it to the package and accessing it in the Java service using Class.forname and it worked like a charm.

Thanks,
Sree

You have only added the jar to your eclipse workspace, this will allow you to reference the classes in your lib so that’s good. However the workspace in eclipse is not the real source, we use only so that you can use the java editor provided by Eclipse. The real service is in your IS and it is your IS that compiles the service. If you haven’t placed the jar in the <SAG_HOME>/IntegrationServer/instances/default/lib/jars (IS) or <SAG_HOME>/IntegrationServer/lib/jars (MSR) then it will not compile without the lib.

Remember you will also need to restart your IS, before you can run this java service.

However, don’t give up on the JDBC adapter just yet, I posted some recommendation in your other post :wink:
Saying that this service will be useful to test whether the connection is with our Adapter or a configuration issue on the DB side i.e. if this service fails, then the issue is a 100% with the network or on the DB side. If it does work then the problem is with our Adapter and you will need to make a brainstorm request with Suresh as he indicated.

regards,
John.

2 Likes

Thank both of you for yours replies. Ive added the jar in <SAG_HOME>/IntegrationServer/instances/default/lib/jars, then
Ive restarted the IS and the BD connection in java service works!

I can connect to that database by java service. Thank u so much.

1 Like

Glad it worked for you.

Thanks,
Sree

Hi John,

it is not neccessary to place the nzjdbc.jar in lib/jars/custom, but it can be placed in the WmJDBCAdapter/code/jars folder.
This enables the possibility to just reload the Adapter package when this jar gets updated or other jars for other database types are added.
It should be suffficient to declare the custom package to be dependent on the WmJDBCAdapter package and it will load in the same class loader context.

Regards,
Holger

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