PooledDatabase

play.api.db.PooledDatabase
class PooledDatabase(name: String, configuration: Config, environment: Environment, val pool: ConnectionPool) extends DefaultDatabase

Default implementation of the database API using a connection pool.

Attributes

Graph
Supertypes
trait Database
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(name: String, configuration: Configuration)

Concrete methods

def closeDataSource(dataSource: DataSource): Unit
def createDataSource(): DataSource

Inherited methods

Attributes

Inherited from:
DefaultDatabase
def getConnection(autocommit: Boolean): Connection

Get a JDBC connection from the underlying data source.

Get a JDBC connection from the underlying data source.

Don't forget to release the connection at some point by calling close().

Value parameters

autocommit

determines whether to autocommit the connection

Attributes

Returns

a JDBC connection

Inherited from:
DefaultDatabase
def getConnection(): Connection

Get a JDBC connection from the underlying data source. Autocommit is enabled by default.

Get a JDBC connection from the underlying data source. Autocommit is enabled by default.

Don't forget to release the connection at some point by calling close().

Attributes

Returns

a JDBC connection

Inherited from:
DefaultDatabase
def shutdown(): Unit

Shutdown this database, closing the underlying data source.

Shutdown this database, closing the underlying data source.

Attributes

Inherited from:
DefaultDatabase
def withConnection[A](autocommit: Boolean)(block: Connection => A): A

Execute a block of code, providing a JDBC connection. The connection and all created statements are automatically released.

Execute a block of code, providing a JDBC connection. The connection and all created statements are automatically released.

Value parameters

autocommit

determines whether to autocommit the connection

block

code to execute

Attributes

Returns

the result of the code block

Inherited from:
DefaultDatabase
def withConnection[A](block: Connection => A): A

Execute a block of code, providing a JDBC connection. The connection and all created statements are automatically released.

Execute a block of code, providing a JDBC connection. The connection and all created statements are automatically released.

Value parameters

block

code to execute

Attributes

Returns

the result of the code block

Inherited from:
DefaultDatabase
def withTransaction[A](isolationLevel: TransactionIsolationLevel)(block: Connection => A): A

Execute a block of code in the scope of a JDBC transaction. The connection and all created statements are automatically released. The transaction is automatically committed, unless an exception occurs.

Execute a block of code in the scope of a JDBC transaction. The connection and all created statements are automatically released. The transaction is automatically committed, unless an exception occurs.

Value parameters

block

code to execute

isolationLevel

determines transaction isolation level

Attributes

Returns

the result of the code block

Inherited from:
DefaultDatabase
def withTransaction[A](block: Connection => A): A

Execute a block of code in the scope of a JDBC transaction. The connection and all created statements are automatically released. The transaction is automatically committed, unless an exception occurs.

Execute a block of code in the scope of a JDBC transaction. The connection and all created statements are automatically released. The transaction is automatically committed, unless an exception occurs.

Value parameters

block

code to execute

Attributes

Returns

the result of the code block

Inherited from:
DefaultDatabase

Inherited fields

lazy val dataSource: DataSource

The underlying JDBC data source for this database.

The underlying JDBC data source for this database.

Attributes

Inherited from:
DefaultDatabase

Attributes

Inherited from:
DefaultDatabase
lazy val driver: Option[Driver]

Attributes

Inherited from:
DefaultDatabase
lazy val url: String

The JDBC connection URL this database, i.e. jdbc:... Normally retrieved via a connection.

The JDBC connection URL this database, i.e. jdbc:... Normally retrieved via a connection.

Attributes

Inherited from:
DefaultDatabase