question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disconnecting and shutting down database connection

See original GitHub issue

Hey,

I’m writing a cluster manager and zero downtime restart library and had a need to shut down the database connection pool that Knex set up. How would I do that?

I do see poolInstance.drain and destroyAllNow used in the base.js file. Are those meant to form the public interface for shutting down Knex?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

21reactions
alechirschcommented, Jan 12, 2017

+1 for @gregbty

The knex instance is not destroyed after running seed. Any ideas?

2reactions
tgriessercommented, Jul 25, 2014

Yep, covered now in: http://knexjs.org/#Installation-pooling

If you ever need to explicitly teardown the connection pool, you may use knex.destroy([callback]). You may use knex.destroy by passing a callback, or by chaining as a promise, just not both.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shutting Down a Database
No new connections are allowed, nor are new transactions allowed to be started, after the statement is issued. · Any uncommitted transactions are...
Read more >
Use SHUTDOWN IMMEDIATE to Shut Down the Oracle ...
During the SHUTDOWN IMMEDIATE , all the connected sessions are disconnected immediately, all uncommitted transactions are rolled back, and the database ...
Read more >
Disconnect from Database - DBeaver Documentation
To disconnect from all active connections, click Database -> Disconnect All on the main menu.
Read more >
Database Host Server Connections Drop after a Period ... - IBM
Connections made by database host server clients such as IBM Toolbox for Java JDBC or IBM i Access Client Solutions ODBC are dropped...
Read more >
dbDisconnect: Disconnect (close) a connection in DBI - Rdrr.io
In DBI: R Database Interface. dbDisconnect, R Documentation. Disconnect (close) a connection. Description. This closes the connection ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found