-2

I'm working on a Go application using the Echo framework, and I'm encountering a 'database connection refused' error when trying to connect to my Apache Age database.

I have the necessary database connection parameters (hostname, port, database name, username, and password) specified in my Go code.

I expected the code to successfully connect to my Apache Age database.

However, I'm getting a 'database connection refused' error. It seems that the application is unable to establish a connection to the database.

Prachi
  • 39
  • 3

3 Answers3

0

I’d assume you’re trying to connect to a postgres server where your database is, the error is mostly due to incorrect credentials while connecting to a database… kindly confirm that the database is running on the said port, the username and password are valid, and the actual database name you are trying to connect to exists.

Peter
  • 43
  • 4
0

To establish a connection with your database, your username must have the permission to access and modify the database directory. Make sure your username has this permissions.

It can be that your database is not running properly. To verify that the correct database is connected, run the \conninfo command in the PostgreSQL CLI. This command will return the database name, user, connection type, and port.

Also, I had a similar problem trying to connect AGE Viewer with my database so try to connect using another framework/AGE Viewer to know if the issue is with your code or with the database server.

Carla
  • 326
  • 1
  • 7
-1

There could be several reasons for this error such as incorrect credentials while connecting to a database, the database is not running properly, the username doesnot have the permission to access and modify the database directory.

You can resolve these issue by trying:

  • Confirm that hte database is running on the said port, the username and password are valid, and the actual database name you are trying to connect to exists.
  • Make sure your username has permission to access and modify the database directory.
  • Verify that the correct Database is connected by running the \\conninfo command n the PostgreSQL CLI. This command will return the database name, use connection type and post.
  • Try connecting using another framework/AGE Viewer to know if the issue is with your code ot with database server.
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/34870929) – JimB Aug 21 '23 at 18:44