Class DatabaseConnection
- java.lang.Object
-
- org.openstreetmap.atlas.checks.database.DatabaseConnection
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class DatabaseConnection extends java.lang.Object implements java.lang.AutoCloseableCreate a PostgreSQL database connection
-
-
Constructor Summary
Constructors Constructor Description DatabaseConnection(java.lang.String connectionUrl)Default constructor takes in a url of the form host[:port]/database.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.sql.ConnectiongetConnection()java.net.URIgetConnectionURI()java.util.Map<java.lang.String,java.lang.String>getQueryParameters()java.lang.StringgetSchema()
-
-
-
Constructor Detail
-
DatabaseConnection
public DatabaseConnection(java.lang.String connectionUrl)
Default constructor takes in a url of the form host[:port]/database. Port and additional query params are optional; i.e, localhost/database would default to port 5432. Also, additional query parameters can be appended to the database name; i.e.localhost/database?user=postgres¤tSchema=public&password=private- Parameters:
connectionUrl- a database url- See Also:
- JDBC connection parameters
-
-
Method Detail
-
close
public void close() throws java.sql.SQLException- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.sql.SQLException
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getConnectionURI
public java.net.URI getConnectionURI()
-
getQueryParameters
public java.util.Map<java.lang.String,java.lang.String> getQueryParameters()
-
getSchema
public java.lang.String getSchema()
-
-