Forum Discussion

mogranovitch's avatar
mogranovitch
Occasional Contributor
3 years ago

Use of global/project property on setting Database Configuration

Hi guys,

I'd like to stop using hard coded values for setting Password on each Database configuration: I have multiple databases for multiple projects/environments and passwords changing every month.

When I tried to use global/project property to store passwords - to have all of them at one place - I do not see that password property parameter I'm trying to set during configuration is being read.

Here is example for storing it as Project property:

password    |   context.expand( '${#Project#dataUserPass}' )

Is there a way to use a parameter in this situation?

 

Thank you!

4 Replies

  • richie's avatar
    richie
    Community Hero
    Hey mogranovitch,

    If i understand what youre trying to do, youre trying to parameterise the database creds, right?

    I know its possible, cos i did it before myself. However i checked the project that i did it in and its become corrupted so it doesnt load into ReadyAPI anymore and xmlspy reports too many substitution chars for me to fix (its an 80000 line .xml file).

    I found an old version of my project that didnt include the parameterisation, so i was gonna attempt to reproduce what i did (cant actually remember how i did it), but because i couldnt remember the password value on my db connection i had to reset it in SSMS. HOWEVER, my ReadyAPI will NOT now connect to the database with the new password and ive done everything i can think of to fix (recreating a new connection with a new driver entry in the jdbc settings but it just wont connect). Im going to have to raise a query to resolve this myself.

    To summarise, i still cant remember quite how i did this, however the link here -->> https://support.smartbear.com/readyapi/docs/testing/data-driven/types/jdbc.html indicates the connection string supports property expansions.

    Normally id reproduce and provide step by step instructions, but as i cant cos of my connection problems, can you please provide screenshots of all your config to see if we cant sort you out?

    Cheers,

    Rich
    • mogranovitch's avatar
      mogranovitch
      Occasional Contributor

      Hi Richie!

      Thank you for your response.

      Here are two screenshots of the PostgreSQL DB config screen:

      1. Working with hard-coded password

       

      2. Not working with parameterized password value. I tried both 'as is' value' and percent-encoded:

       

       

      Thanks again!

      • richie's avatar
        richie
        Community Hero
        Hey mogranovitch,

        I dont think i used those property fields....i cant be sure...but i dont think i did.

        Im curious, if in say the password property youve setup, instead of using an expansion, if you hardcode the value instead, do you connect ok? I think yousay you did, but just wanted to confirn

        Have you tried just adding expansions into the dynamically generated fields (generated relative to which driver you specify) instead?

        So in my sqlserver connection, when i select the driver, i get a host, and password, dbname and i think thats it (going off memory here)

        So...in my sqlserver (if i did have a working db connection) in the password field did you try adding the expansion in there? i.e. ${#Project#password}

        I "think" thats what i did when i did this before about 4 years ago. I had to switch to 2 different databases (local and remote) depending on which environment and whatever i did, it worked like a charm!

        Cheers

        Rich