Saturday, 19 November 2016

Database Testing with Appium & JDBC

Appium is limited to testing your mobile applications. To use Appium for Database Testing you need to use the JDBC ("Java Database Connectivity").JDBC (Java Database Connectivity) is a SQL level API which allows you to execute SQL queries using java code . JDBC is used for enabling  connectivity between the Java Programming language and a wide range of databases. 

To test with database we need to learn how to connect with database first then how to execute queries followed by how to process the results.

Video Tutorial -

1. Connect to Database -

In order to make a connection to the database the syntax is as per given below and after connection setup you also need to load the JDBC Driver.

Connection con = DriverManager.getConnection(dbUrl,username,password);


  • Userid is the username configured in the database
  • Password of the configured user
  • URL is of format jdbc:< dbtype>://ipaddress:portnumber/db_name"

2.  Execute Queries -

Once connection is made, you need to execute queries.You can use the Statement Object to send queries. First Create Statement and once the statement object is created use the executeQuery method to execute the SQL queries.

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(select * from employee); 


3. Process Results -

As in above example we have seen that after query execution the result is stored in  ResultSet Object. with this class object we can perform loads of actions to process an test the results as per our requirement.
  • String getString() - get the string type data from ResultSet.
  • int getInt() - get the integer type data from ResultSet.
  • double getDouble() - get the double type data from ResultSet.
  • Date getDate() - get the date type data from ResultSet.
  • boolean next() - move to next record in the ResultSet.
  • boolean previous() - move to previous record in the ResultSet.
  • boolean first() - move to first record in the ResultSet.
  • boolean last() - move to last record in the ResultSet.
  • boolean absolute(int rowNumber) - move to perticular record in the ResultSet.


  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

  2. This comment has been removed by the author.

  3. Your good knowledge and kindness in playing with all the pieces were
    very useful. I don’t know what I would have done if I had not
    encountered such a step like this.

    java training in chennai

    java Training in Bangalore