Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var debug = require('debug')('app:dbConn');
- var express = require('express');
- var router = express.Router();
- const sql = require('mssql');
- //BASE DE DADES REAL
- const config1 = { server: "IP1", database: "DB1", user: "foo", password: "foopass", port: 1433 };
- const config2 = { server: "IP2", database: "DB2", user: "foo2", password: "foopass2", port: 1433 };
- // Conexions
- const pool1 = new sql.ConnectionPool(config1)
- pool1.connect()
- .then(function() {
- debug('Connected to SQL Server1');
- }).catch(function(err) {
- debug('Error connect SQL Server1n %O', err);
- })
- const pool2 = new sql.ConnectionPool(config2)
- pool2.connect()
- .then(function() {
- debug('Connected to SQL Server2');
- }).catch(function(err) {
- debug('Error connect SQL Server2n %O', err);
- });
- module.exports = {"DB1": pool1, "DB2": pool2}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement