PostgreSQL Database Close

I find that if I do not close the connection to the PostgreSQL database after a method executes, I can end up where the application hangs when trying to connect in another process.

I am wondering what is the preferred manner to do this.

Can you simply call:


at the end of any method that calls the database?

I have read that if the recordset goes out of scope, the database is automatically closed, so does it cause a problem to close the connection to the database with myDB.close just to be sure?

In the event that the method creates 5 different recordsets, can I assume that myDB.close would handle that (in case one recordset remains)?

Is myDB.close the same as myDB.SQLExecute(“DISCONNECT”) ?

you call close or just let the object go away in your app.

Nothing special you need to do.

OK. Thanks.