所有操作执行完成后,必须关闭与数据库的连接。

可以使用​Connection​对象的​close​方法关闭连接,如下所示:

conn.close();

说明通常应将​close​语句放在​finally​子句中。