Package play.db
Class Databases
- Object
-
- play.db.Databases
-
public final class Databases extends Object
Creation helpers for manually instantiating databases.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Database
createFrom(String driver, String url)
Create a pooled database named "default" with the given driver and url.static Database
createFrom(String name, String driver, String url)
Create a pooled database with the given configuration.static Database
createFrom(String name, String driver, String url, Map<String,? extends Object> config)
Create a pooled database with the given configuration.static Database
createFrom(String driver, String url, Map<String,? extends Object> config)
Create a pooled database named "default" with the given configuration.static Database
inMemory()
Create an in-memory H2 database with name "default".static Database
inMemory(String name)
Create an in-memory H2 database.static Database
inMemory(String name, String url, Map<String,? extends Object> config)
Create an in-memory H2 database.static Database
inMemory(String name, Map<String,? extends Object> config)
Create an in-memory H2 database.static Database
inMemory(String name, Map<String,String> urlOptions, Map<String,? extends Object> config)
Create an in-memory H2 database.static Database
inMemory(Map<String,? extends Object> config)
Create an in-memory H2 database with name "default".static Database
inMemoryWith(String k1, Object v1)
Create an in-memory H2 database with name "default" and with extra configuration provided by the given entries.static Database
inMemoryWith(String k1, Object v1, String k2, Object v2)
Create an in-memory H2 database with name "default" and with extra configuration provided by the given entries.static Database
inMemoryWith(String k1, Object v1, String k2, Object v2, String k3, Object v3)
Create an in-memory H2 database with name "default" and with extra configuration provided by the given entries.
-
-
-
Method Detail
-
createFrom
public static Database createFrom(String name, String driver, String url, Map<String,? extends Object> config)
Create a pooled database with the given configuration.- Parameters:
name
- the database namedriver
- the database driver classurl
- the database urlconfig
- a map of extra database configuration- Returns:
- a configured database
-
createFrom
public static Database createFrom(String name, String driver, String url)
Create a pooled database with the given configuration.- Parameters:
name
- the database namedriver
- the database driver classurl
- the database url- Returns:
- a configured database
-
createFrom
public static Database createFrom(String driver, String url, Map<String,? extends Object> config)
Create a pooled database named "default" with the given configuration.- Parameters:
driver
- the database driver classurl
- the database urlconfig
- a map of extra database configuration- Returns:
- a configured database
-
createFrom
public static Database createFrom(String driver, String url)
Create a pooled database named "default" with the given driver and url.- Parameters:
driver
- the database driver classurl
- the database url- Returns:
- a configured database
-
inMemory
public static Database inMemory(String name, String url, Map<String,? extends Object> config)
Create an in-memory H2 database.- Parameters:
name
- the database nameurl
- the database urlconfig
- a map of extra database configuration- Returns:
- a configured in-memory h2 database
-
inMemory
public static Database inMemory(String name, Map<String,String> urlOptions, Map<String,? extends Object> config)
Create an in-memory H2 database.- Parameters:
name
- the database nameurlOptions
- a map of extra url optionsconfig
- a map of extra database configuration- Returns:
- a configured in-memory h2 database
-
inMemory
public static Database inMemory(String name, Map<String,? extends Object> config)
Create an in-memory H2 database.- Parameters:
name
- the database nameconfig
- a map of extra database configuration- Returns:
- a configured in-memory h2 database
-
inMemory
public static Database inMemory(String name)
Create an in-memory H2 database.- Parameters:
name
- the database name- Returns:
- a configured in-memory h2 database
-
inMemory
public static Database inMemory(Map<String,? extends Object> config)
Create an in-memory H2 database with name "default".- Parameters:
config
- a map of extra database configuration- Returns:
- a configured in-memory h2 database
-
inMemory
public static Database inMemory()
Create an in-memory H2 database with name "default".- Returns:
- a configured in-memory h2 database
-
inMemoryWith
public static Database inMemoryWith(String k1, Object v1)
Create an in-memory H2 database with name "default" and with extra configuration provided by the given entries.- Parameters:
k1
- an H2 configuration key.v1
- configuration value corresponding to `k1`- Returns:
- a configured in-memory H2 database
-
inMemoryWith
public static Database inMemoryWith(String k1, Object v1, String k2, Object v2)
Create an in-memory H2 database with name "default" and with extra configuration provided by the given entries.- Parameters:
k1
- an H2 configuration keyv1
- H2 configuration value corresponding to `k1`k2
- a second H2 configuration keyv2
- a configuration value corresponding to `k2`- Returns:
- a configured in-memory H2 database
-
inMemoryWith
public static Database inMemoryWith(String k1, Object v1, String k2, Object v2, String k3, Object v3)
Create an in-memory H2 database with name "default" and with extra configuration provided by the given entries.- Parameters:
k1
- an H2 configuration keyv1
- H2 configuration value corresponding to `k1`k2
- a second H2 configuration keyv2
- a configuration value corresponding to `k2`k3
- a third H2 configuration keyv3
- a configuration value corresponding to `k3`- Returns:
- a configured in-memory H2 database
-
-