title: How to handle IndexOutofBounException if the SQL query does not return any results in Selenium?
body: <p>In my automation script, one data has to be fetched from SQL in order to fill a form for certain conditions.
  So, I run the SQL query, and store the first data (from the 0th position) in a String like this:</p>
  <pre><code>String name = (String) DBUtil.executeQuery(&quot;&lt;QUERY&gt;&quot;, new Object[0]).get(0).get(&quot;&lt;COLUMN_Name&gt;&quot;);
  </code></pre>
  <p>I am doing this one class where the test scripts is written. Following is the executeQuery method written in another class DBUtil, and it works fine for all the queries.</p>
  <p>The issue that I am facing is when the query does not fetch any results, and nothing gets stored in the String name.
  In that case, upon running the test script, it throws IndexOutofBounException as as no result is fetched.
  Can anyone suggest on how to handle this part?</p>