Hi,
I am running into some problem with FindBug Problem where it ask
certain method that contain a sql statment will fail to close the
statement. I tried several options such as having a finally and close
connection there, but it seems nothing will fix this bug. I am out of
idea...
The code something like this:
public void increaseRank(String key) throws SQLException
{
Statement statement = connection.createStatement();
String query="SELECT rank From article Where articleKey='"+key+"';";
ResultSet resultSet=statement.executeQuery(query);
int rank = 0;
while(resultSet.next())
{
rank=resultSet.getInt("rank");
}
rank++;
System.out.println(rank);
query="UPDATE article SET rank='"+Integer.toString(rank)+"' WHERE
articleKey='"+key+"';";
statement.executeUpdate(query);
}
Thanks,
Jason