I create this method to close statement and connection
public void disconnetti(){
try
{
if(stmt2!=null)
stmt2.close();
if(_conn!=null)
_conn.close();
System.out.println(stmt2);
System.out.println(_conn);
}
catch(Exception e)
{
System.out.println("errore: "+ e);
}
finally
{
stmt2=null;
_conn=null;
}
System.out.println(stmt2);
System.out.println(_conn);
}
Inside the try catch,when i do the syso value of _conn, it is different from null.. why is possible?
Inside finally I assign manually value null at variable _conn
the methodology is right or am I wrong?
output
null
com.mysql.jdbc.JDBC4Connection@10a2ed93
null
null