node_postgres/script.js

24 lines
539 B
JavaScript
Raw Normal View History

const { Pool, Client } = require('pg')
const pool = new Pool({
user: 'ptrowbridge',
host: '192.168.1.110',
database: 'ubm',
password: 'gyaswddh1983',
port: 5432,
})
pool.query('SELECT NOW()', (err, res) => {
console.log(err, res)
pool.end()
})
const client = new Client({
user: 'ptrowbridge',
host: '192.168.1.110',
database: 'ubm',
password: 'gyaswddh1983',
port: 5432,
})
client.connect()
client.query('SELECT * from pg_stat_activity', (err, res) => {
console.log(err, res)
client.end()
})