c

play.api.db

DefaultDatabase

abstract class DefaultDatabase extends Database

Default implementation of the database API. Provides driver registration and connection methods.

Source
Databases.scala
Linear Supertypes
Database, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DefaultDatabase
  2. Database
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new DefaultDatabase(name: String, configuration: Config, environment: Environment)

Abstract Value Members

  1. abstract def closeDataSource(dataSource: DataSource): Unit
  2. abstract def createDataSource(): DataSource

Concrete Value Members

  1. lazy val dataSource: DataSource

    The underlying JDBC data source for this database.

    The underlying JDBC data source for this database.

    Definition Classes
    Database
  2. val databaseConfig: DatabaseConfig
  3. def deregisterDriver(): Unit
  4. lazy val driver: Option[Driver]
  5. 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().

    autocommit

    determines whether to autocommit the connection

    returns

    a JDBC connection

    Definition Classes
    Database
  6. def getConnection(): Connection

    Get a JDBC connection from the underlying data source.

    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().

    returns

    a JDBC connection

    Definition Classes
    Database
  7. val name: String

    The configuration name for this database.

    The configuration name for this database.

    Definition Classes
    Database
  8. def shutdown(): Unit

    Shutdown this database, closing the underlying data source.

    Shutdown this database, closing the underlying data source.

    Definition Classes
    Database
  9. lazy val url: String

    The JDBC connection URL this database, i.e.

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

    Definition Classes
    Database
  10. def withConnection[A](autocommit: Boolean)(block: (Connection) => A): A

    Execute a block of code, providing a JDBC connection.

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

    autocommit

    determines whether to autocommit the connection

    block

    code to execute

    returns

    the result of the code block

    Definition Classes
    Database
  11. def withConnection[A](block: (Connection) => A): A

    Execute a block of code, providing a JDBC connection.

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

    block

    code to execute

    returns

    the result of the code block

    Definition Classes
    Database
  12. def withTransaction[A](isolationLevel: TransactionIsolationLevel)(block: (Connection) => A): A

    Execute a block of code in the scope of a JDBC transaction.

    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.

    isolationLevel

    determines transaction isolation level

    block

    code to execute

    returns

    the result of the code block

    Definition Classes
    Database
  13. def withTransaction[A](block: (Connection) => A): A

    Execute a block of code in the scope of a JDBC transaction.

    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.

    block

    code to execute

    returns

    the result of the code block

    Definition Classes
    Database