Change the code to
while(rs.next()){
if(rs.getString(1)!=null && rs.getString(1).equals(props.getProperty("db.dbname")))
{
System.out.println("xxx");
}
}
There is no need of a for
loop. The query show databases;
will return a resultset with a single column.so, you can get the data using rs.getString(1)
since column id starts from 1