I'm working on application that get the DS from PCF (Pivotal Cloud FoundrY) User provided services. It's working properly but I want to understand how the validation interval is defined.
As Spring and PCF are managing my connection pool. I'd like to understand how that works.
public DataSource getProfileDS() {
PoolConfig poolConfig = new PoolConfig(5, 10, 30000);
DataSourceConfig dsConfig = new DataSourceConfig(poolConfig, null);
return connectionFactory().dataSource("profileDS", dsConfig);
}
Also, is there any way to set up the validation interval by my own like we are used to do under the tomcat?
Spring Cloud Config will define a validation query that is appropriate for your relational database.
Examples:
As to the validation interval, it does not look like that's being configured. Instead, the DBCP-like pools use
testOnBorrow
, and Hikari is configured to useconnectionTestQuery
. When testing before obtaining a connection from the pool, setting the validation interval is unnecessary.Not if you're going to use Spring Cloud Connectors, but you don't have to use Spring Cloud Connectors. There's a couple of other ways you can do this.
VCAP_SERVICES
as properties likevcap.services.<name>.credentials.username
. You could use those to manually define a DataSource. See here.Hope that helps!