Connection to Postgre with JavaScript

0

Good morning, I need to create a script that makes connection with a postgre database , so that when you run capture a value that is in the database . Someone knows the code that allows me the connection and the query through Javascript . I have tried the following instructions but the ActiveXObject is not recognized. Apparently ActiveXObject has to do is with windows.

var objConnection = new ActiveXObject("adodb.connection");
var strConn = "pg_connect('host=localhost, port=5432, user=admin, pass=123, 
dbname=mi_base_datos')";
objConnection.Open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");
var strQuery = "select public.'Contador'.'Numero' from public.'Contador';";
rs.Open(strQuery, objConnection);
rs.MoveFirst();
while (!rs.EOF) 
{
   alert = rs.fields(0);
           rs.movenext();
}

They know some other method   Thanks for your time.

    
asked by martin7 04.04.2017 в 14:38
source

0 answers