I'm using tomcat connection pool org.apache.tomcat.jdbc.pool.DataSource
. The connections appear in my database pg_stat_activity
with empty application_name
.
How could I set that application name in my java app, so I know where each connection comes from (as there will be multiple applications accessing the same db)?
PostgreSQL Connection Limits At provision, Databases for PostgreSQL sets the maximum number of connections to your PostgreSQL database to 115. 15 connections are reserved for the superuser to maintain the state and integrity of your database, and 100 connections are available for you and your applications.
The default connection timeout limit to PostgreSQL data sources is 30 seconds.
You could specify the application name in the connection string.
Documentation here.
Example:
jdbc:postgresql://localhost:5435/DBNAME?ApplicationName=MyApp
Take care: the param names are case sensitive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With