Skip to content

Instantly share code, notes, and snippets.

@greenkey
Created February 29, 2016 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenkey/d0a3c7035205bd0367de to your computer and use it in GitHub Desktop.
Save greenkey/d0a3c7035205bd0367de to your computer and use it in GitHub Desktop.
How to easily use JDBC in a SoapUI Test Case

How to easily use JDBC in a SoapUI Test Case

Choose the DB and get the JDBC driver

First we need to know to which DBMS we want to connect. You can find all the supported driver in the JDBC Driver List page of the SoapUI website. Take note of the Driver name, i.e. oracle.jdbc.driver.OracleDriver and download the .jar file.

Put the jar file in the ext directory, it should be in ithe same folder as the SoapUI start script. In Linux, you can find it in this way:

$~ which SoapUI-5.2.1
/usr/local/bin/SoapUI-5.2.1
$~ ls -l /usr/local/bin/SoapUI-5.2.1
lrwxrwxrwx 1 root root 44 feb  9 15:40 /usr/local/bin/SoapUI-5.2.1 -> /opt/SmartBear/SoapUI-5.2.1/bin/SoapUI-5.2.1
$~ cd /opt/SmartBear/SoapUI-5.2.1/bin             
$bin ls -l
...
drwxr-xr-x 2 root root     4096 feb 29 17:50 ext
...

Use the connection in a JDBC Request Test Step

  1. Create a JDBC Request Test Step in a Test Case;
  2. set the driver name in the Driver field, i.e. oracle.jdbc.driver.OracleDriver;
  3. set the Connection String, i.e. jdbc:oracle:thin:user/password@//host.or.ip.address:1521/SID;
  4. click on the TestConnection button to test the connection.

Now you can use the SQL Query to get values or verify them.

Enjoy

@chatelao
Copy link

Great tip, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment