문제

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