public interface DataSourceFactory
DataSourceFactory factory = DataSourceFactory.get();
DataSourceConfig config = new DataSourceConfig();
config.setDriver("org.h2.Driver");
config.setUrl("jdbc:h2:mem:tests2");
config.setUsername("sa");
config.setPassword("");
DataSourcePool pool = factory.createPool("test", config);
Connection connection = pool.getConnection();
| Modifier and Type | Method and Description |
|---|---|
DataSourcePool |
createPool(String name,
DataSourceConfig config)
Create the DataSourcePool with the given configuration.
|
static DataSourceFactory |
get()
Return the DataSourceFactory.
|
static DataSourceFactory get()
The implementation is obtained via standard service loader mechanism requiring an implementation to be in the classpath.
DataSourcePool createPool(String name, DataSourceConfig config)
name - The name of the pool.config - The configuration options.Copyright © 2018. All rights reserved.