Comments (4)
Do you not use a database with pooling? Managing your own connections is usually not recommended. You can configure pooling in the knex config object.
from sqldatasource.
Also it looks like you are using an older version of this lib. In v1 the format is different which may explain it not connecting. Check out the readme for more information!
from sqldatasource.
I'm using this with oracledb and it looks like the pool connection keeps the event loop busy and so the process does not exit.
I'm especially concern about this as I will be executing within an AWS lambda.
After discussing with the guys behind oracledb module, I was suggested to close the pool when the SIGTERM/SIGINT signals are issued.
I do this where I create the datasources.
const Clients = require("./clients");
const OracleAnalytics = require("./oracle-analytics");
const Oracle = new OracleAnalytics();
const dataSources = () => ({
clients: new Clients(),
oracleAnalytics: Oracle
});
module.exports = dataSources;
async function closePoolAndExit() {
try {
await Oracle.db.destroy();
console.log("Pool closed");
process.exit(0);
} catch (err) {
console.error(err.message);
process.exit(1);
}
}
process.once("SIGTERM", closePoolAndExit).once("SIGINT", closePoolAndExit);
Here is the thread about oracledb Github Thread
from sqldatasource.
Note, please use the KNEX documentation for pooling, this is merely a thin wrapper on top of KNEX.
from sqldatasource.
Related Issues (20)
- Buffers: Handle buffer values in cache
- Allow constructor to take a knex instance HOT 3
- Error: "this.driver.Database is not a constructor" when using sqlite HOT 2
- Cache invalidation HOT 1
- Too many connections opened HOT 1
- Any plan to support TS? HOT 1
- Support provided cacheKey HOT 2
- Examples for parameterized queries and mutations HOT 1
- How to implement Aggregation? HOT 2
- Peer version of graph-ql set to ^14.0.2" HOT 2
- receive error when .cache is provided: UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined HOT 1
- Clarification on correct way to create instance. HOT 3
- Add db to typescript type HOT 2
- Knex types is broken in 1.6.0 HOT 13
- SET Postgres run-time configuration parameters HOT 2
- ERROR: Can't extend QueryBuilder with existing method ('cache') - when initating with knex connection HOT 7
- Property 'cache' does not exist on type QueryBuilder HOT 7
- Using example will result in major security issues HOT 2
- Support for Apollo 4? HOT 1
- Knex QueryBuilder toString is unreliable for producing cache keys for PG. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqldatasource.