
# 关闭数据库连接
在完成相应的数据操作后，应调用close()方法关闭数据库连接。
```
conn.close();
```
![](https://support.huaweicloud.com/distributed-devg-v10-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
Connection、Statement和ResultSet接口都提供close()方法，在使用完对象后应及时关闭它们。关闭Connection对象将间接关闭所有与之关联的Statement对象，关闭Statement对象则会间接关闭其对应的ResultSet对象。
