Establish DB Connection in soapUI

Today in my post, I shall write about establishing JDBC connection in soapUI. Specifically we shall look into establishing MySQL database connection from soapUI.
First let us look into the fundamental aspects of establishing a DB connection. In order to establish any database connection following are the main resources required for establishing DB connection from any 3rd party DB clients / Testing Tool's.
  • DB Driver details.
  • DB Connection URL or DB URL
  • DB Name and Credentials.
  • Relevant DB jars.
In some Clients we only need to provide DB URL &  DB credentials including Database information combined together and also most of the DB Clients will have the DB drivers and jar files handy, only thing is you need to configure it properly. Lets not get into this in detail at this point of time. Ultimately these are the important resources required for establishing a DB connection.

Let us see what soapUI (open source) has to offer us for establishing database connection.
I will be using MySQL database and Currency Convertor Webservice  from WebServicex.NET as an example to illustrate this. I have created a worldcurrency table in MySQL and below are the structure and contents of the table.


Now open soapUI, create a new Project and Create a Test Suite for Currency Convertor Web Service. To know more about Creating a new project in soapUI check out my earlier post here. If you are new to soapUI please check out my earlier posts on soapUI.
Now expand the Test Suite, Right Click on the Test Steps. Select Add Step and the select JDBC Request as shown below.

















Double click on the JDBC Request, Now in the Configuration box provide the  Driver, Connection String URL details and then Click on Test Connection Arrow (Green) Button. Now you should be able to get a Successful pop up message as shown below.



















Now type the SQL query as shown below and click on the Arrow button (Green) at the top to execute the Request.











This is all about Establishing DB connection in soapUI. In continuation with this post, in my next post I shall write in detail about fetching a data from DB and passing it as an input to Currency Convertor Request.
Let me know if the above approach worked for you. Till then happy reading..!! :)

Establish DB Connection in soapUI Establish DB Connection in soapUI Reviewed by Suntaragali The Smart Techie on February 27, 2013 Rating: 5

No comments: