Forum Discussion

vintage52's avatar
vintage52
Occasional Contributor
12 years ago

[Resolved] Environment Handling - Env to JDBC

Hello all

I've set up two environments at Project level using the following guide as per the link below:

http://www.soapui.org/Working-with-Projects/environment-handling-in-soapui.html

I have two JDBC connections configured.

I have added custom dbDriver and dbConnection properties at env project level.
I have assigned the driver and connection strings to each property respectively.
I then reference the properties in each of my JDBC request steps like this: ${#Project#dbDriver} and {#Project#dbConnection}.

When running the entire test suite or just a test case within the suite with an environment selected in the TestSuites tab, the JDBC Requests fail.

When I look at the guide it does not say how to point a specific env to a specific JDBC.

Appreciate any help I can get.

Cheers

Bill

10 Replies

  • vintage52's avatar
    vintage52
    Occasional Contributor
    Also when the referenced connection string is called by the JDBC request it is passing through no value for the PASS_VALUE.

    Help me Obi-wan....you're my only hope.

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hey Bill,

    Linking different database connections to different environments can be a little confusing, but is actually pretty simple. Here's how you do it.

    Once you've created a JDBC Connection and created one or more environments, go to the "Environments" in the project view and select one of your environments. Then, select the "JDBC Connections" tab below, select one of the connections and click the "Options" icon. Any changes you make there are only going to be applied for the selected environment. When making a JDBC request, you can then select your connection, which will change dynamically depending on which environment you've selected.

    Does this help you out? Let me know if you have any further questions and I'll assist

    Regards,

    Arian
    SmartBear Sweden
  • vintage52's avatar
    vintage52
    Occasional Contributor
    Hi Arian

    What I have done is the following:

    At project level:
    Two environments configured.
    Two JDBC Connections configured.

    While on the Environment tab and selecting the JDBC Connections both JDBC Connections configured at Project level are present.

    When selecting one environment and navigating to the JDBC Connections tab I see the following:



    Both connections present. Which is the Options icon that enables me to point to the required JDBC connection I want to use?

    The Options icon on the JDBC only allows me to configure the existing JDBC connection.

    Regards

    Bill
  • I think the support was trying to say is just create one JDBC Connection. Create as many environments as you want. Now in the environment tab, select the environment you want to configure, select the single JDBC connection, click "Configures the selection data connection". Now you are configuring the DB connection for the environment you selected. After you are done with that connection, select other environment, and repeat the JDBC configuration process. After you all done, if you select different environment, you shall see the JDBC configurations will be different from environment to environment even you have only one line of JDBC connection (the values, like driver and connections string, for that connection will change from environment to environment). HTH.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Move Canada Support wrote:
    I think the support was trying to say is just create one JDBC Connection. Create as many environments as you want. Now in the environment tab, select the environment you want to configure, select the single JDBC connection, click "Configures the selection data connection". Now you are configuring the DB connection for the environment you selected. After you are done with that connection, select other environment, and repeat the JDBC configuration process. After you all done, if you select different environment, you shall see the JDBC configurations will be different from environment to environment even you have only one line of JDBC connection (the values, like driver and connections string, for that connection will change from environment to environment). HTH.


    Excellent explanation - yes, that was what I meant. Does this make sense to you, Bill? As I said before, I understand that this feature can be a bit confusing.

    Regards,

    Arian
    SmartBear Sweden
  • vintage52's avatar
    vintage52
    Occasional Contributor
    Thanks to HTH and Arian.

    I get it now. The implicitness of it eluded me at first but now....awesomeness!

    Thanks so much.

    Very cool feature and sorry for being so slow to get it!

    Close this one out boys......we're moving forward....
  • vintage52's avatar
    vintage52
    Occasional Contributor
    Well.....ok...hang about a bit there mate!



    How do I expand the Project level JDBC Driver and Connection String to my JDBC connection steps please?

    Ta again.
  • vintage52's avatar
    vintage52
    Occasional Contributor
    This can be marked resolved.

    A learned colleague displayed to me that selecting the JDBC connection drop down on the step would mean that the Environment selected would pas its connection properties through to each JDBC Connection configuration.

    I think what I was looking for was a global setting that said "when env selected, default all JDBC Connections to this env".

    Which is what is does now but there is still the manual process of actually selecting the connection from the drop down when writing the JDBC connection SQL.

    Cheers all and thanks again for the patience.

    Bill
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Great to hear that you managed to resolve it

    Regards,

    Arian
    SmartBear Sweden