I closed result set but its till showing warning "Multiple annotations found at this line: - Resource leak: 'resultSet' is not closed at this location - Resource leak: 'resultSet' is not closed at this location"
<%
Connection connection = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/sm_db", "root", "root");
Statement statement = connection.createStatement() ;
DatabaseMetaData metadata = connection.getMetaData();
ResultSet resultSet;
resultSet = metadata.getTables(null, null, "SmartMiner", null);
while(resultSet.next())
{
//table exists
try{
resultSet=statement.executeQuery("SELECT*FROM SmartMiner") ;
}finally{
resultSet.close();
}
%>
<div style="overflow-x:auto;">
<table BORDER="1" style="margin-left:112px; border: 2px solid lightblue;">
<%
ResultSetMetaData rsmd = resultSet.getMetaData();
int numOfCols = rsmd.getColumnCount();%>
<tr>
<%for(int i = 1; i <= numOfCols; i++){%>
<th> <%= rsmd.getColumnName(i)%> </th>
<%}%>
</tr>
<%while(resultSet.next()){%>
<tr>
<%for(int i = 1; i <= numOfCols; i++){%>
<td> <%= resultSet.getString(i)%> </td>
<%}%>
</tr>
<%}
}
resultSet.close();
statement.close();%>
</table>