Authentication fails for Postgresql DB connection within a test case, but not as a Data File

I need a connection to a specific postgresql within my Test Case, but I’m unable to connect to the DB with this error message:

org.postgresql.util.PSQLException: FATAL: password authentication failed for user "xxxxxxxx"

The only problem is the same database with exact same server, database, username and password can be connected to if I add it to the “Data Files” section.

Right now, this is what my code looks like in the test case:

CustomKeywords.'com.database.postgreSQL.connectDB'('servername', 'port', 'dbname", "user", "password")

A different database from the same server works ok though.