public class DBConnections
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
protected java.util.List<DBConnection> |
connections |
the database connnections
|
protected int |
consecutiveErrors |
the number of times the system has failed a request
|
protected int |
consecutiveFailures |
the number of times the system has failed to get a db
|
protected java.lang.String |
dbClass |
|
protected java.util.Map<java.lang.String,java.lang.String> |
dbParms |
the jdbc args
|
protected java.lang.String |
dbPass |
the odbc password
|
protected java.lang.String |
dbService |
the odbc service
|
protected java.lang.String |
dbUser |
the odbc login user
|
protected boolean |
disconnected |
the disconnected flag
|
protected boolean |
errorQueingEnabled |
Object to synchronize around on error handling
|
protected boolean |
lockedUp |
the im in trouble flag
|
protected int |
maxConnections |
number of connections to make
|
protected boolean |
reuse |
whether to reuse connections
|
protected boolean |
shutdown |
set this to true once, cuz it makes it all go away.
|
protected boolean |
transact |
whether to reuse connections
|
Constructor | Description |
---|---|
DBConnections(java.lang.String dbClass,
java.lang.String dbService,
java.lang.String dbUser,
java.lang.String dbPass,
java.util.Map<java.lang.String,java.lang.String> dbParms,
int numConnections,
boolean reuse,
boolean transact,
boolean doErrorQueueing) |
Initialize this class.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
amIOk() |
Return the happiness level of the connections
Usage: amIOk()
|
void |
clearErrors() |
|
void |
DBDone(DBConnection D) |
Return a DBConnection object fetched with DBFetch()
Usage:
|
DBConnection |
DBFetch() |
Fetch a single, not in use DBConnection object.
|
DBConnection |
DBFetchAny(java.lang.String SQL,
DBConnection.FetchType type) |
Fetch a single, not in use DBConnection object.
|
DBConnection |
DBFetchEmpty() |
|
DBConnection |
DBFetchPrepared(java.lang.String SQL) |
|
DBConnection |
DBFetchTest() |
Fetch a single, not in use DBConnection object.
|
boolean |
deregisterDriver() |
|
void |
enQueueError(java.lang.String SQLString,
java.lang.String SQLError,
java.lang.String tries) |
Queue up a failed write/update for later processing.
|
java.lang.StringBuffer |
errorStatus() |
return a status string, or "" if everything is ok.
|
static long |
getLongRes(java.sql.ResultSet Results,
java.lang.String Field) |
When reading a database table, this routine will read in
the given Field NAME, returning the value.
|
static java.lang.String |
getRes(java.sql.ResultSet Results,
int One) |
When reading a database table, this routine will read in
the given One index number, returning the value.
|
static java.lang.String |
getRes(java.sql.ResultSet Results,
java.lang.String Field) |
When reading a database table, this routine will read in
the given Field NAME, returning the value.
|
static java.lang.String |
getResQuietly(java.sql.ResultSet Results,
java.lang.String Field) |
|
boolean |
isFakeDB() |
|
void |
killConnections() |
Destroy all database connections, effectively
shutting down this class.
|
void |
listConnections(java.io.PrintStream out) |
list the connections
Usage: listConnections(out);
|
int |
numAvailable() |
|
int |
numConnectionsMade() |
Return the number of connections made.
|
int |
numInUse() |
|
int |
pingAllConnections(java.lang.String querySql,
long usageTimeoutMillis) |
Pings all connections not currently in use.
|
int |
queryRows(java.lang.String queryString) |
Usage: update("UPDATE...");
|
void |
reportError() |
|
void |
resetConnections() |
|
void |
retryQueuedErrors() |
Queue up a failed write/update for later processing.
|
int |
update(java.lang.String[] updateStrings) |
Usage: update("UPDATE...");
|
int |
updateWithClobs(java.lang.String[] updateStrings,
java.lang.String[][][] values) |
Usage: updateWithClobs("UPDATE...");
|
int |
updateWithClobs(java.lang.String updateString,
java.lang.String[][] values) |
Usage: updateWithClobs("UPDATE...");
|
int |
updateWithClobs(java.util.List<DBConnector.DBPreparedBatchEntry> entries) |
Usage: updateWithClobs("UPDATE...");
|
protected java.lang.String dbClass
protected java.lang.String dbService
protected java.lang.String dbUser
protected java.lang.String dbPass
protected java.util.Map<java.lang.String,java.lang.String> dbParms
protected int maxConnections
protected boolean disconnected
protected boolean lockedUp
protected int consecutiveFailures
protected int consecutiveErrors
protected boolean errorQueingEnabled
protected java.util.List<DBConnection> connections
protected boolean shutdown
protected boolean reuse
protected boolean transact
public DBConnections(java.lang.String dbClass, java.lang.String dbService, java.lang.String dbUser, java.lang.String dbPass, java.util.Map<java.lang.String,java.lang.String> dbParms, int numConnections, boolean reuse, boolean transact, boolean doErrorQueueing)
dbClass
- the odbc servicedbService
- the odbc servicedbUser
- the odbc user logindbPass
- the odbc user passworddbParms
- extra jdbc parametersnumConnections
- Connections to maintainreuse
- Whether to reuse connectionstransact
- true to group statements into a transactiondoErrorQueueing
- whether to save errors to a filepublic int update(java.lang.String[] updateStrings)
updateStrings
- the update SQL commandspublic int updateWithClobs(java.util.List<DBConnector.DBPreparedBatchEntry> entries)
entries
- the update SQL commandspublic int updateWithClobs(java.lang.String[] updateStrings, java.lang.String[][][] values)
updateStrings
- the update SQL commandsvalues
- the update SQL command valuespublic int updateWithClobs(java.lang.String updateString, java.lang.String[][] values)
updateString
- the update SQL commandsvalues
- the update SQL valuespublic int numConnectionsMade()
public int numInUse()
public int numAvailable()
public int pingAllConnections(java.lang.String querySql, long usageTimeoutMillis)
querySql
- the query to use as a pingusageTimeoutMillis
- the idle time to use to decide which connections to ping.public DBConnection DBFetch()
public DBConnection DBFetchTest()
public DBConnection DBFetchAny(java.lang.String SQL, DBConnection.FetchType type)
SQL
- The prepared statement SQLtype
- the type of fetching to dopublic boolean isFakeDB()
public DBConnection DBFetchPrepared(java.lang.String SQL)
public DBConnection DBFetchEmpty()
public void DBDone(DBConnection D)
D
- The Database connection to return to the poolpublic static java.lang.String getRes(java.sql.ResultSet Results, java.lang.String Field)
Results
- The ResultSet object to useField
- Field name to returnpublic static long getLongRes(java.sql.ResultSet Results, java.lang.String Field)
Results
- The ResultSet object to useField
- Field name to returnpublic static java.lang.String getRes(java.sql.ResultSet Results, int One)
Results
- The ResultSet object to useOne
- Field number to returnpublic static java.lang.String getResQuietly(java.sql.ResultSet Results, java.lang.String Field)
public boolean deregisterDriver()
public void resetConnections()
public void killConnections()
public boolean amIOk()
public void enQueueError(java.lang.String SQLString, java.lang.String SQLError, java.lang.String tries)
SQLString
- UPDATE style SQL statementSQLError
- The error message being reportedtries
- The number of tries to redo it so farpublic void retryQueuedErrors()
public int queryRows(java.lang.String queryString)
queryString
- the update SQL commandpublic void listConnections(java.io.PrintStream out)
out
- place to send the list out topublic void reportError()
public void clearErrors()
public java.lang.StringBuffer errorStatus()