You need to instantiate stmt
somewhere (in the constructor or inside select
function)
You can also move stmt
field to be a variable of select
function.
public ResultSet select(String sql)
{
Statement stmt = link.createStatement();
rs = stmt.executeQuery(sql);
return rs;
}