Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. var debug = require('debug')('app:dbConn');
  2. var express = require('express');
  3. var router = express.Router();
  4.  
  5. const sql = require('mssql');
  6.  
  7. //BASE DE DADES REAL
  8. const config1 = { server: "IP1", database: "DB1", user: "foo", password: "foopass", port: 1433 };
  9. const config2 = { server: "IP2", database: "DB2", user: "foo2", password: "foopass2", port: 1433 };
  10. // Conexions
  11.  
  12. const pool1 = new sql.ConnectionPool(config1)
  13. pool1.connect()
  14. .then(function() {
  15. debug('Connected to SQL Server1');
  16. }).catch(function(err) {
  17. debug('Error connect SQL Server1n %O', err);
  18. })
  19.  
  20. const pool2 = new sql.ConnectionPool(config2)
  21. pool2.connect()
  22. .then(function() {
  23. debug('Connected to SQL Server2');
  24. }).catch(function(err) {
  25. debug('Error connect SQL Server2n %O', err);
  26. });
  27.  
  28.  
  29. module.exports = {"DB1": pool1, "DB2": pool2}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement