Example 7-1 Creating a Method to Close All Open Objects
public void closeAll() {
if ( rset != null ) {
try { rset.close();
}
catch ( Exception ex ) {}
rset = null;
}
if ( stmt != null ) {
try {
stmt.close();
}
catch ( Exception ex ) {}
stmt = null;
}
if ( conn != null ) {
try {
conn.close();
}
catch ( Exception ex ) {}
conn = null;
}
}
The complete closeAll method should look similar to that shown in Example 7-1.