Database Connection Refused

Hi,

After running my application from the IDE several times, I get the error Database connection refused with the reason too many connections. Checking the database connections, I see lots of connection from my application. I thought the connection will be closed when the application is stopped. How do I explicitly close connection?

Hi Harvey,

I’m using Intellij and I know that if I force kill the applications in run in it, I sometimes have hanging processes, so possibly also hanging database connections.
A bit of searching for your issue lets me think it depends on the database you’re using by the way.
For postgres, I for example found the following, and for mysql the following might help.

Anyhow, I’m unsure if this is an Axon issue actually. I’m guessing it might have something to do with the way the application is closed or particular database settings.
How are you wiring up the database to your Axon application? Maybe that clarifies the issue a bit.

Hope this helps!

Cheers,
Steven

Hi Stephen,

I use Intellij too. The database is configured in the application.properties file.

Hi Stephen,

do you have any database specific configuration in your Spring application context?
Do you use the Jpa/Hibernate or JDBC components for Axon? Explicitly configured or using auto-configuration?

Allard