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 Connection
getConnection()
Open a connection to the database.Connection
getConnection(Properties props)
Open a connection to the database.Properties
getConnectionProperties()
Get properties for a database connection.abstract String
getName()
Get the name of the database driver.abstract String
getUrl()
Get the JDBC-URL to the database.String
getUser()
abstract void
init()
Init the JDBC-driver before the first connection is established.void
setUser(String user, String pass)
Setup user account for connecting the database server.void
shutdown()
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 ClassNotFoundException
Init 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.
-
-