Is is a good practice to set
JDBC object references to null after closing them?
Consider following scenario:
1. There is a class A which contains an instance variable(con) of type Connection and a getConnection and setConnection method. The getConnection method initializes a connection using JNDI lookup.
Suppose there is a class B which subclasses class A. There is a method in class B which uses con (Instance Variable inherited from class A ). con is initialized by calling getConnection (inherited method from class A.).
The question is whether we should set the reference con to null (con=null) after finishing up all jdbc tasks and calling con.close(). Is there a thing like closedConnection instance which is still referred by variable con untill con is set to null.