Connection.release()

NES3+Syntax

							connection.release()

Description

The release() method of the Connection object returns the connection to the DbPool instance after all cursors have been closed. If you do not close the cursor, the connection will remain until it times out or the variable holding your connection, assuming you assigned it to one, goes out of scope. Depending on how you have written your application, this can happen when the application is stopped, the Web server is stopped, or when control leaves the HTML page.

Example

Listing 8.22 shows a pool being created, a connection being pulled from the pool, and a query run against the database. Once the cursor is closed, the connection is released.

Listing 8.22 Releasing a Connection ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.