public class DBConnection extends SMYLDObject implements Runnable
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
connected |
protected Vector<DBConnectionListener> |
connectionListeners |
static int |
DB_RECONNECT_SLEEP_TIME |
protected Connection |
dbConnection |
protected Vector<DBConnectionListener> |
internalConnectionListeners |
protected boolean |
reconnecting |
protected DBSettings |
settings |
NEW_LINE, OS_NEW_LINE| Constructor and Description |
|---|
DBConnection() |
DBConnection(DBSettings settings) |
DBConnection(String path) |
DBConnection(String newUserName,
String newUserPass,
String newDBName) |
DBConnection(String newUserName,
String newUserPass,
String newDBName,
String newPort,
String newHost) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDBConnectionListener(DBConnectionListener newConnectionListener) |
void |
addDBConnectionListener(DBConnectionListener newConnectionListener,
int priorty) |
void |
addInternalDBConnectionListener(DBConnectionListener newConnectionListener) |
void |
addInternalDBConnectionListener(DBConnectionListener newConnectionListener,
int priorty) |
Object |
clone() |
Connection |
createConnection() |
boolean |
detectConnectionError(Exception ex) |
Connection |
getConnection()
Basic implementation that throws a SQLException
|
String |
getConnectionPath() |
DBSettings |
getSettings() |
boolean |
isConnected() |
boolean |
isReconnecting() |
static Properties |
loadDBParams(String path)
Loads the properties file from the given path
|
void |
reconnect() |
void |
releaseConnections() |
void |
run()
Code for keep reconnecting until the connection for the data base is
established again
|
void |
setConnectionPath(String newConnectionPath) |
void |
setSettings(DBSettings newSettings) |
debug, getLenName, insertInstanceValue, printInstanceValues, toStringprotected DBSettings settings
protected boolean reconnecting
protected boolean connected
protected Connection dbConnection
protected Vector<DBConnectionListener> connectionListeners
protected Vector<DBConnectionListener> internalConnectionListeners
public static final int DB_RECONNECT_SLEEP_TIME
public DBConnection(DBSettings settings)
public DBConnection(String newUserName, String newUserPass, String newDBName, String newPort, String newHost)
public DBConnection(String path)
public DBConnection()
public void setSettings(DBSettings newSettings)
public DBSettings getSettings()
public void releaseConnections()
throws SQLException
SQLExceptionpublic Connection getConnection()
public Connection createConnection() throws SQLException
SQLExceptionpublic void reconnect()
throws SQLException
SQLExceptionpublic boolean isReconnecting()
public static Properties loadDBParams(String path)
public String getConnectionPath()
public void setConnectionPath(String newConnectionPath)
public void addInternalDBConnectionListener(DBConnectionListener newConnectionListener)
public void addInternalDBConnectionListener(DBConnectionListener newConnectionListener, int priorty)
public void addDBConnectionListener(DBConnectionListener newConnectionListener, int priorty)
public void addDBConnectionListener(DBConnectionListener newConnectionListener)
public boolean detectConnectionError(Exception ex)
public boolean isConnected()
Copyright © 2019 SMYLD. All rights reserved.