forked from joeferner/node-oracle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
35 lines (33 loc) · 798 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var ora = require('../lib/oracle');
var settings = {
host:'localhost',
database:'XE',
username:'scott',
password:'tiger',
minConn:1,
maxConn:5,
incrConn:1,
timeout: 10
};
var sql = 'SELECT ID, NAME FROM PRODUCT';
// var pool = ora.createConnectionPoolSync(settings);
ora.createConnectionPool(settings, function(err, pool) {
if(err) {
console.error(err);
return;
}
console.log(pool.getInfo());
pool.getConnection(function(err, conn) {
conn.setAutoCommit(false);
console.log(pool.getInfo());
console.log(sql);
console.log(conn.executeSync(sql, []));
conn.commit(function(err, result) {
console.log(err, result);
conn.close();
console.log(pool.getInfo());
pool.close();
console.log(pool.getInfo());
});
});
});