public class SqlServiceImpl extends Object implements org.spongepowered.api.service.sql.SqlService, Closeable
This implementation does a few interesting things
- It's thread-safe
- It allows applying additional driver-specific connection
properties -- this allows us to do some light performance tuning in
cases where we don't want to be as conservative as the driver developers
- Caches DataSources. This cache is currently never cleared of stale entries
-- if some plugin makes database connections to a ton of different databases
we may want to implement this, but it is kinda unimportant.
Modifier and Type | Class and Description |
---|---|
static class |
SqlServiceImpl.ConnectionInfo |
Constructor and Description |
---|
SqlServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Optional<String> |
getConnectionUrlFromAlias(String alias) |
DataSource |
getDataSource(String jdbcConnection) |
public DataSource getDataSource(String jdbcConnection) throws SQLException
getDataSource
in interface org.spongepowered.api.service.sql.SqlService
SQLException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException