Class DatabaseInfo
java.lang.Object
de.softwareforge.testing.postgres.embedded.DatabaseInfo
Information about a database located on a PostgreSQL server connected to an
EmbeddedPostgres
instance.-
Method Summary
Modifier and TypeMethodDescriptionReturns aDataSource
instance connected to the described database.Returns a JDBC url to connect to the described database.Returns all properties that are be applied to a new data source connection to this database.abstract String
dbName()
Returns the name of the database.abstract int
port()
Returns the TCP port for the database server.abstract String
user()
Returns the user that can connect to this database.
-
Method Details
-
dbName
Returns the name of the database.- Returns:
- Name of the database. Is never null.
-
port
public abstract int port()Returns the TCP port for the database server.- Returns:
- A port number. May be -1 if this objects represents an error connection.
-
user
Returns the user that can connect to this database.- Returns:
- The user name. Is never null.
-
connectionProperties
@NonNull public abstract com.google.common.collect.ImmutableMap<String,String> connectionProperties()Returns all properties that are be applied to a new data source connection to this database. See the PostgreSQL JDBC driver documentation for a comprehensive list.- Returns:
- Map of key-value pairs representing data source connection properties.
- Since:
- 3.0
-
asJdbcUrl
Returns a JDBC url to connect to the described database.- Returns:
- A JDBC url that can be used to connect to the database. Never null.
-
asDataSource
Returns aDataSource
instance connected to the described database.- Returns:
- An initialized
DataSource
object. Never null. - Throws:
SQLException
- A problem occurred trying to connect to the database.
-