strongloop / strong-oracle

Deprecated: Node.js Driver for Oracle databases (Use https://github.com/oracle/node-oracledb instead)
Other
45 stars 18 forks source link

Connection Pool #64

Closed stella-di closed 8 years ago

stella-di commented 8 years ago

I want to create a connection pool to ORACLE with node.js

var oracle = require('strong-oracle')(settings);
var connectionPool;

oracle.createConnectionPool(settings, function (err, pool) {
    if (err) {
        callback(err);
    }

    connectionPool = pool;        
});

Can I get the instance of pool using the code below?

function getPool(){    
    return connectionPool;
}
bnoordhuis commented 8 years ago

Yes, but it's going to return undefined until the oracle.createConnectionPool() callback has run.

bnoordhuis commented 8 years ago

@stella-di Did you delete your other comment?

Can I get pool object without callback?

Yes, use the synchronous version: connectionPool = oracle.createConnectionPoolSync(settings). I'll close the issue, I think that answers it, doesn't it?

stella-di commented 8 years ago

Yes! It is an answer. Thanks a lot!