- First of all, double click on your project on the left side pane of soapUI.
- Now, navigate to the tab "JDBC Connections" on the right side pane.
- Click on the plus sign and provide the necessary details and configure the database connection.
- Name the connection as "JDBCTest1" (we will be referring this JDBC connection later on the groovy script.)
- Test the JDBC connection before closing the dialog box.
// Below line will create an object of the already created JDBC connection.
def ConObj = context.testCase.testSuite.project.databaseConnectionContainer.getDatabaseConnectionByName('JDBCTest1');
//Below line is using the connection String from already created JDBC connection.
def Con = Sql.newInstance(ConObj.getConnectionString());
def res = Con.rows("select *from tablename;");
Con.close();
Thanks. This is what I am looking for.
How can we use groovy scripting with DataSource and DataConnection
Nice job!
This helped me into the right path but i am not there yet. I am looking for a way of selecting in one place one of the preconfigured database connections and to set the same configuration to all JDBC requests in my different test suites.
Hopefully you can help me with this.
Thanks in advance!
which version of soapui does this supports
i was unable to find the JDBC connection step when i double clicked on my project