title: TestNg Parameters
body: <p>I am new to SELENIUM TESTNG, i need to create a method contains two parameters<br>
  one i am sending the parameter form testng xml and the other i am passing from where the method is called.</p>
  
  <p>I want to have a reusable code to check which DB connection i want to use and the same method uses the query to be executed.</p>
  
  <p>@Parameters({"env"})</p>
  
  <pre><code>@Test(dataProvider = "query")
  
  public static int DataBase(String env,String query) throws SQLException, InstantiationException, 
          IllegalAccessException, ClassNotFoundException {
  
      Class.forName("net.sourceforge.jtds.jdbc.Driver");
  
      switch (env) {
       case "ENV1":
           con = DriverManager.getConnection("ENV1 CON");
           break;
       case "ENV2":
           con = DriverManager.getConnection("ENV2 Con");
           break;
      default:
              break;
      }   
      Statement statement = con.createStatement();
  
      // We use Sybase specific select getdate() query to return date
      ResultSet rs = statement.executeQuery(query);
  
  
      if (rs.next()) {
          S1 = rs.getInt(1);
          S2 = rs.getString(2);
          S3 = rs.getString(3); 
          System.out.println(S1+" "+S2+" "+S3);
      }
      rs.close();
      statement.close();
      con.close();
  
      return S1;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Could you please let know how to achieve this.</p>