Question

I'm using bonecp, JDBCTemplate and postgresql in a Spring application.

I want to set the application_name of each connection in the connection pool

The following psql statement sets the application name:

set application_name = 'my_application'

But JDBCTemplate will only execute it on the first available connection.

Does anyone know if if there a way to iterate the connections in the pool or whether there is a way to execute a single statement on all connections.

Was it helpful?

Solution

Ah,

It seems that the BoneCPDataSource has a property called InitSQL that executes when each connection is created.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top