Forum Discussion

indraniria's avatar
3 years ago

How do I switch DB for postgresql using ReadyApi?

When I run command SELECT session_user, current_database(); , it shows a different db than what I would like to query. How do I switch to a different db ?

2 Replies

  • richie's avatar
    Community Hero
    Hey indraniria,

    Ok. Youre not talking about a jdbc test step here are you? This is java, right? So how are you running the command 'SELECT session_user, current_database();' in a groovyscript step? Event handler step? Startup/teardown steps?

    If you post the relevant script we should be able to help out.

    Im guessing your current_database() method is pointing at your postgresql db, so youd need to find where the parms are set and change them accordingly.

    Depending on what version of ReadyAPI you have you should be able to see which database connections that have already been setup.

    Gonna need more info i think to provide further help.


  • I am talking about jdbc test step only. I am able to make successful connection to db using jdbc step. 

    Now if I run query SELECT session_user, current_database() , I see its pointing to default postgres db. My question is how I switch to some other db?