Package com.openindex.openestate.tool.db
Class AbstractDbDriver
- java.lang.Object
-
- com.openindex.openestate.tool.db.AbstractDbDriver
-
- Direct Known Subclasses:
AbstractLocalDbDriver,AbstractRemoteDbDriver
public abstract class AbstractDbDriver extends Object
AbstractDbDriver.- Author:
- Andreas Rudolph
-
-
Constructor Summary
Constructors Constructor Description AbstractDbDriver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ConnectiongetConnection()Open a connection to the database.ConnectiongetConnection(Properties props)Open a connection to the database.PropertiesgetConnectionProperties()Get properties for a database connection.abstract StringgetName()Get the name of the database driver.abstract StringgetUrl()Get the JDBC-URL to the database.StringgetUser()abstract voidinit()Init the JDBC-driver before the first connection is established.voidsetUser(String user, String pass)Setup user account for connecting the database server.voidshutdown()Shutdown the database driver, before the application is closed.
-
-
-
Method Detail
-
getConnection
public final Connection getConnection() throws SQLException
Open a connection to the database.- Returns:
- database connection
- Throws:
SQLException
-
getConnection
public final Connection getConnection(Properties props) throws SQLException
Open a connection to the database.- Parameters:
props- properties for the created connections- Returns:
- database connection
- Throws:
SQLException
-
getConnectionProperties
public final Properties getConnectionProperties()
Get properties for a database connection.- Returns:
- connection properties
-
getName
public abstract String getName()
Get the name of the database driver.- Returns:
- driver name
-
getUrl
public abstract String getUrl()
Get the JDBC-URL to the database.- Returns:
- JDBC-URL
-
getUser
public String getUser()
-
init
public abstract void init() throws ClassNotFoundExceptionInit the JDBC-driver before the first connection is established.- Throws:
ClassNotFoundException- JDBC-driver is not found
-
setUser
public final void setUser(String user, String pass)
Setup user account for connecting the database server.- Parameters:
user- usernamepass- password
-
shutdown
public void shutdown()
Shutdown the database driver, before the application is closed.
-
-