Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
NodeJS Knex database fallback for MySQL database

I am using the knex library (https://www.npmjs.com/package/knex) for NodeJS and MySQL and I would like to implement a fallback database connection in case that the current database is not reachable anymore.

I ve read that via the knex config it is possible to use for example the config options "ping" (https://github.com/knex/knex/issues/1198#issuecomment-185310131) and "afterCreate" (https://github.com/knex/documentation/pull/17/files) to detect if it is not possible anymore to connect to the database.

But in case it is not possible how exactly can i overwrite the existing connection settings, establish a new database connection and make it available to all upcoming queries within these config options?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!