public interface Database
Modifier and Type | Method and Description |
---|---|
java.sql.Connection |
getConnection()
Get a JDBC connection from the underlying data source.
|
java.sql.Connection |
getConnection(boolean autocommit)
Get a JDBC connection from the underlying data source.
|
javax.sql.DataSource |
getDataSource()
The underlying JDBC data source for this database.
|
java.lang.String |
getName()
The configuration name for this database.
|
java.lang.String |
getUrl()
The JDBC connection URL this database, i.e.
|
void |
shutdown()
Shutdown this database, closing the underlying data source.
|
default play.api.db.Database |
toScala()
Converts the given database to a Scala database
|
<A> A |
withConnection(boolean autocommit,
ConnectionCallable<A> block)
Execute a block of code, providing a JDBC connection.
|
void |
withConnection(boolean autocommit,
ConnectionRunnable block)
Execute a block of code, providing a JDBC connection.
|
<A> A |
withConnection(ConnectionCallable<A> block)
Execute a block of code, providing a JDBC connection.
|
void |
withConnection(ConnectionRunnable block)
Execute a block of code, providing a JDBC connection.
|
<A> A |
withTransaction(ConnectionCallable<A> block)
Execute a block of code in the scope of a JDBC transaction.
|
void |
withTransaction(ConnectionRunnable block)
Execute a block of code in the scope of a JDBC transaction.
|
java.lang.String getName()
javax.sql.DataSource getDataSource()
java.lang.String getUrl()
java.sql.Connection getConnection()
java.sql.Connection getConnection(boolean autocommit)
autocommit
- determines whether to autocommit the connectionvoid withConnection(ConnectionRunnable block)
block
- code to execute<A> A withConnection(ConnectionCallable<A> block)
block
- code to executevoid withConnection(boolean autocommit, ConnectionRunnable block)
autocommit
- determines whether to autocommit the connectionblock
- code to execute<A> A withConnection(boolean autocommit, ConnectionCallable<A> block)
autocommit
- determines whether to autocommit the connectionblock
- code to executevoid withTransaction(ConnectionRunnable block)
block
- code to execute<A> A withTransaction(ConnectionCallable<A> block)
block
- code to executevoid shutdown()
default play.api.db.Database toScala()