Node.js + postgres连接

时间:2014-03-19 05:07:24

标签: node.js postgresql sequelize.js

在我的节点应用程序中,我连接到远程系统中的postgres sql

我有以下连接代码:

var sequelize = new Sequelize('postgres://username:password@xxx.xxx.xx.xx:5432/dbname');

它的工作正常..但以下连接不起作用:

// initialize database connection
var sequelize = new Sequelize(
config.dbname,
config.username,
config.password, {
    dialect: 'postgres',
    port:'5432'------------------->specified port here..
});

我的配置文件:

{
    "server": {
        "port":        3000,
        "forks":        1,
        "siteUrl":      "http://xxx.xxx.xx.xxx:3000"
    },
    "dbpostgres": {
        "host":         "xxx.xx.xx.xx",        
        "username":     "username",
        "port"     :     5432,
        "password":     "password",        
        "dbname":       "dbname"
        }

我收到以下错误:

"Error: connect ECONNREFUSED","    at errnoException (net.js:770:11)","  

请帮我解决这个问题..提前谢谢......

}

0 个答案:

没有答案