Database Testing using Selenium WebDriver

How to perform SQL Database testing using Selenium and JDBC?

In order to perform database testing, the most important part is to run sql queries.

This method uses JDBC driver to connect to the SQL database and execute a query. This  returns data from SQL database and that can be used further for any assertion in database testing automation.

While writing the method we assumed that the query to be run will return a table with column “empid“. This is just a sample database connection and validation. You can change it to suite your requirement. 

Example code- How to get data from sql database