Ask a Question

unable to connect to db2 database in linux environment

Occasional Contributor

unable to connect to db2 database in linux environment

established a connection sucessfully through groovy in windows to DB2 environment but the same is not working in the linux environment.

if (environment=="qa"){
sql = Sql.newInstance('jdbc:db2://x.x.x.x:xxxxx/bd2:currentSchema=QA;','username', 'pwd','');
//checks for dev

res = sql.firstRow("SELECT id FROM table1 AS a, Table2 AS b where a.value ='"+myvalue+ "' and a.ID = b.ID");[0])

i have added the required jar files(db2jcc_license_cu.jar,db2jcc4.jar & sqljdbc42.jar) in the root/readyAPI/bin/etc folder in linux still unable to establish the connect to the bd.

any one faced simillar kind of issue.



Occasional Contributor

i have also checked the jar files added to classpath.

Occasional Contributor

i am using ReadyAPI 2.5.0



It's been about 4 years since I worked on DB2 - but I remember a couple of points - the supported SQL is different if you are running SQL against a DB on z/OS relative to Linux  - literally functions like left trim and right trim are different depending on the operating system!  yeah - I know - weird right?


Anyway - I'm just putting this out there - have you confirmed that you have the correct .jar driver files for the operating system AND JAVA version? 


I can't remember much - but have you confirmed that switching to Linux doesnt require different .jar files? Also - and you've probably done this already - but I'd re-confirm the JAVA version you're running too just to be sure!


Finally - can you query the db from another tool using the  .jar driver files?  Something like DBvisualiser - just to confirm the .jar files and Java versions are correct?






if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Community Hero

Is it READYAPI_HOME/bin/ext directory where you copied jar files? And restarted the tool?
When do you actually having issue? Is it when ReadyAPI tool installed on linux? Or DB2 on linux?

What is the error?

Occasional Contributor

The issue is fixed with the help of my CI/CD team member.. what he has done is used in custom environment... beacuse of which unable to get the custom settings.

One thing for sure is having issues with project level properties.

the same project level proprties are working in windows and the same project level properties are not working in linux.


def db_ip = context.expand( '${#Project#db_ip}' ).toString();"db_ip = " + db_ip) 

is Failing


def db_ip = context.expand( '${#TestCase#db_ip}' ).toString();"db_ip = " + db_ip)  is working

the version i used is 2.5.0 & 2.6.0 ReadyAPI

SmartBear Alumni (Retired)

Hi @chikki78,


Happy to hear that at least one of the issues has been resolved. I've marked the previous post with your solution accordingly.

As for the issue with a project property, I suggest that you check if you see the same behavior in the latest maintenance build. If you do, please report this issue to our Support Team.


Tanya Yatskovskaya
SmartBear Community and Education Manager

Showing results for 
Search instead for 
Did you mean: