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
...
JDBC Request
Test Step
Use the connection in a - Create a JDBC Request Test Step in a Test Case;
- set the driver name in the
Driver
field, i.e.oracle.jdbc.driver.OracleDriver
; - set the Connection String, i.e.
jdbc:oracle:thin:user/password@//host.or.ip.address:1521/SID
; - click on the
TestConnection
button to test the connection.
Now you can use the SQL Query to get values or verify them.
Enjoy
Great tip, thank you