Parameterising JDBC Connection Settings..Can you do it?
Hi,
I'm trying to create a project that I can lift and shift between environments no matter the data in the underlying database - so I need to parameterise anything that is environment specific but i'm struggling with the JDBC steps.
The summary of my question is --> how are people parameterising their JDBC Test Step connection details so they don't have to edit the content of EVERY SINGLE JDBC TEST STEP when they switch to a different environment?
Please see below for what I've tried.
Ages back nmrao showed me a way of storing all environment specific variables at project level using an environment specific properties file which works except for my JDBC connection settings.
i.e. create a 'QA_properties' file that looks like the following:
EnvironmentDomainHost=https://platform.www-whatever.net
Authorization_HeaderParm=eyJhbGciOiJIUzI1NiIsInR5cC
X-Auth-Key_AdminHeaderParm=8b0d7bf2-9aa3-4e29-8b4e-79a4c7bde384
X-Auth-Key_HeaderParm=8683f790-18de-4906-a65b-67565d18c676
JDBC_Driver=com.mysql.jdbc.Driver
JDBC_Host=104.211.13.14
JDBC_Port=3306
JDBC_DB=mab_user
JDBC_User=ulo_user
JDBC_Password=thisIsNotTheRealPassword
JDBC_ConnectionURL=jdbc:mysql://whatever:3306/db?user=xxxUser
So database I need to connect to is mySQL v8. I've downloaded JDK17, I've installed the mySQL v8 driver file and copied it into the correct /Program Files/ReadyAPI!/bin/ext directory and confirmed the connection works.
First thing - when I select the correct PREVIOUSLY created connection my JDBC test step
I was expecting the 'Driver' the 'Connection String' and the 'Password' to be auto populated with the details already set in my Database Connections function - didn't this auto populate before?
Because those fields aren't populated - I decided to use the 'Get Data' function that is available and pick up the relevant values from my custom project properties (sourced from the 'QA_properties' file - see above) - so it appears as follows:
The 'Get Data' function appears to let me point to a parameter value stored elsewhere - however - if I try running the query or testing the DB connection - it fails.
I think there might be a couple of defects that is hindering me being able to do this - I'm pretty sure one earlier versions of ReadyAPI a couple of years ago auto populated the 'Driver' 'ConnectionString' and the 'Password' fields once the pre-existing DB connection was set.
I don't remember trying to parameterise the DB Connection details before now - HOWEVER - why include functionality that supports parameterisation with the Get Data function and allow me to point to a custom project property if it's not allowed?
Can anyone advise? How would any one else here parameterise a JDBC Test Step in a project so that when lifting and shifting their ReadyAPI! project to a different environment they don't have to edit EVERY Single JDBC test step?
I'm gonna have hundreds and hundreds of tests and virtually every single one of those will require a JDBC test step.
Yes I would like to use REST as an alternative - but there are no native REST APIs supporting querying mySQL (unlike stuff like Azure DB, etc.). I'd need a developer to code a REST API to support this.
Cheers,
Rich