Connection to database

I recently ported my work from a linux OS to Windows and my Postgresql connections have stopped working. I have the following code:

id = dbAddDatabase("PSQL");
dbSetHostName(id, "localhost");
dbSetPort(id, 5432);
dbSetDatabaseName(id, "database");
dbSetUserName(id, "user");
dbSetPassword(id, "password");
ret = dbOpen(id);

I get the error message:

Database returned the following error:
Database is invalid.
Database driver returned the following error:
(null)

I know the database exists and tested it through psql in the command prompt.

2 Answers



0



On Linux the Postgres client libraries are probably already in the system path, so nothing further was needed. On Windows, the directory will need to be added to the PATH environment variable so the client libraries can be located by GAUSS.

You will want to locate the directory that contains the file "libpq.dll" in your Postgres installation directory. This directory should be added to the PATH environment variable. GAUSS will need to be restarted as well.

aptech

1,773


0



That solved it. I had added the directory to my PATH variable but didn't restart GAUSS. Makes sense.

Your Answer

2 Answers

0

On Linux the Postgres client libraries are probably already in the system path, so nothing further was needed. On Windows, the directory will need to be added to the PATH environment variable so the client libraries can be located by GAUSS.

You will want to locate the directory that contains the file "libpq.dll" in your Postgres installation directory. This directory should be added to the PATH environment variable. GAUSS will need to be restarted as well.

0

That solved it. I had added the directory to my PATH variable but didn't restart GAUSS. Makes sense.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.