Forum Discussion

chikki78's avatar
chikki78
Occasional Contributor
6 years ago

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','com.ibm.db2.jcc.DB2Driver');
//checks for dev
}

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

log.info(res[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.

 

 

6 Replies

  • chikki78's avatar
    chikki78
    Occasional Contributor

    i have also checked the jar files added to classpath.

      • richie's avatar
        richie
        Community Hero

        Hi,

         

        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?

         

        Cheers,

         

        richie

         

  • nmrao's avatar
    nmrao
    Champion Level 3
    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?