I face the following error in trying to connect to PostgreSql database in (linux) docker container from windows desktop via vbscript:
Microsoft OLE DB Provider for ODBC Drivers (30, 11) : FATAL: password authentication failed for user "dev" FATAL: password authentication failed for user "dev"
Here is the demo vb-code:
Dim cn
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
'Open the Postgre Databse connection (Driver must be installed)
cn.Open "Driver={PostgreSQL ANSI};" & _
"Server=localhost;" & _
"Port=5432;" & _
"UID=dev;" & _
"PWD=dev;" & _
"Database=dbname;"
rs.Open "SELECT * FROM tablename", cn
While Not rs.EOF
WScript.Echo( rs("id") & ": " & rs("name"))
rs.MoveNext
Wend
And here is the docker-compose.yml:
version: "3.8"
services:
anon-db:
image: postgres:9.6.3
environment:
POSTGRES_USER: dev
POSTGRES_PASSWORD: dev
POSTGRES_DB: dbname
ports:
- 5432:5432
volumes:
- anon-pgdata:/var/lib/postgresql/data
container_name: anon-db
Vbscript above works fine with the non-containerized PostgreSQL database. Can anyone figure out but what is wrong with the container-settings or with something else with the code? The given error speaks of the password / authentication issue but I cannot see why.