Home > Articles

  • Print
  • + Share This
Like this article? We recommend

Shutdown

Listing 14 illustrates the steps required to release all the resources allocated during the Derby program. I removed the exception handling code just to show the bare minimum steps. The SimpleApp.java program includes all the necessary exception handling.

Listing 14 Closing up shop with Derby

rs.close();
s.close();
System.out.println("Closed result set and statement");
conn.commit();
conn.close();
DriverManager.getConnection("jdbc:derby:;shutdown=true");

In Listing 14, the ResultSet object and the Statement object are both explicitly closed. The Connection object is committed and then explicitly closed. Finally, Derby itself is shut down after which the program exits.

  • + Share This
  • 🔖 Save To Your Account