I try to connect to remote PostgreSQL server from my Windows client. When I connect to the database using "Dbeaver" i hava to fill the Network connection (SSH) and it connects OK.
I am developing an application in VB.NET that have to connect to the database but i can't make it posible.
I am using Devart dll to connect to the database and Renci.SshNet dll to connect to server.
I have managed to connect to the server, apparently via SSH because the log say that but when i try to connect to DDBB it throws an error:
no hay una línea en pg_hba.conf para "xx.xx.xx.xxx", usuario "xxx", base de datos "xxxx", SSL inactivo
The connection code is the next:
Dim connectionInfo As New PasswordConnectionInfo(IP, USER, PASS)
connectionInfo.Timeout = TimeSpan.FromSeconds(30)
client = New SshClient(connectionInfo)
client.Connect()
Dim portFwld As New ForwardedPortLocal("127.0.0.1", Convert.ToUInt32(PORT_SSH), IP, Convert.ToUInt32(5432))
client.AddForwardedPort(portFwld)
portFwld.Start()
Log(client.IsConnected)
Log(portFwld.IsStarted)
client.IsConnected = true and portFwld.IsStarted = true
The error is here (when Open):
Dim myConnection As PgSqlConnection = New PgSqlConnection()
Try
myConnection.ConnectionString = "Server=" & IP & ";Port=5432;Database=" & BBDD_Postgre & ";User Id=" & USER & ";Password=" & PASS & ";"
myConnection.Open()
I have tried many combinations but none has been valid and I do not know what else to look at, I am lost. I think if "Dbeaver" can connect from my PC, why my application can't? why my server have to add my IP in pg_hba.conf if without it "Dbeaver" runs?