Вопрос

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.

Это было полезно?

Решение

Ah,

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top