public class DBConnection
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
DBConnection.FetchType |
Modifier and Type | Field | Description |
---|---|---|
protected int |
failuresInARow |
number of failures in a row
|
protected boolean |
inUse |
Whether this dbconnection is being used
|
protected boolean |
isReusable |
|
protected java.lang.String |
lastError |
if any SQL errors occur, they are here.
|
protected java.lang.String |
lastSQL |
for tracking the last sql statement made
|
protected boolean |
sqlserver |
Constructor | Description |
---|---|
DBConnection(DBConnections parent,
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,
boolean useTransactions,
boolean dbReuse) |
construction
Usage: DBConnection("","","");
|
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
catalog() |
|
void |
clearFailures() |
known errors should not be a reason to report a dead state
Usage: clearFailures();
|
void |
close() |
shut down this connection totally
Usage: close()
|
protected void |
closeStatements(java.lang.String Closer) |
|
protected void |
doneUsing(java.lang.String Closer) |
report this connection as being free
Usage: doneUsing("roll back");
|
java.lang.String |
getLastError() |
returns an error if there was one
Usage: getLastError();
|
long |
getLastQueryTime() |
Return the time, in millis, when this connection
was last returned.
|
java.sql.PreparedStatement |
getPreparedStatement() |
returns the prepared statement, if creates
Usage: getPreparedStatement();
|
int |
getRecordCount(java.sql.ResultSet R) |
Returns the number of records in the given result set.
|
boolean |
inSQLServerCommunication() |
|
boolean |
inUse() |
returns whether this connection is in use
Usage: inUse();
|
boolean |
isFakeDB() |
|
boolean |
isProbablyDead() |
returns whether this connection is *probably* dead
Usage: isProbablyDead();
|
boolean |
isProbablyLockedUp() |
returns whether this connection is *probably* locked up
Usage: isProbablyLockedUp();
|
java.sql.ResultSet |
query(java.lang.String queryString) |
execute a query, returning the resultset
Usage: R=query("SELECT STATEMENT");
|
boolean |
ready() |
returns whether this connection is ready for use
Usage: ready();
|
boolean |
rePrepare(java.lang.String SQL) |
set up this connection for use as a prepared statement
Requires an already in use connection.
|
void |
setPreparedClobs(java.lang.String[] vals) |
Sets all the clobs in the prepared statement to the given strings
|
int |
update(java.lang.String updateString,
int retryNum) |
execute an sql update, returning the status
Usage: update("UPDATE STATEMENT");
|
boolean |
use(java.lang.String openerSQL) |
set up this connection for use
Usage: use("begin transaction")
|
boolean |
useEmpty() |
set up this connection for use
Usage: useEmpty()
|
boolean |
usePrepared(java.lang.String SQL) |
set up this connection for use as a prepared statement
Usage: usePrepared("SQL String")
|
protected volatile boolean inUse
protected java.lang.String lastError
protected volatile int failuresInARow
protected volatile boolean sqlserver
protected boolean isReusable
protected volatile java.lang.String lastSQL
public DBConnection(DBConnections parent, 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, boolean useTransactions, boolean dbReuse) throws java.sql.SQLException
parent
- the parent connections objectdbClass
- JDBC ClassdbService
- ODBC SERVICEdbUser
- ODBC LOGIN USERNAMEdbPass
- ODBC LOGIN PASSWORDdbParms
- JDBC extra argumentsuseTransactions
- true to group statements into a transactiondbReuse
- Whether the connection can be reused.java.sql.SQLException
- a sql errorpublic java.lang.String catalog()
public boolean isFakeDB()
public void close()
public boolean use(java.lang.String openerSQL)
openerSQL
- Any SQL string you'd like to sendpublic boolean useEmpty()
public boolean usePrepared(java.lang.String SQL)
SQL
- Any SQL string you'd like to usepublic boolean rePrepare(java.lang.String SQL)
SQL
- Any SQL string you'd like to useprotected void closeStatements(java.lang.String Closer)
protected void doneUsing(java.lang.String Closer)
Closer
- Any SQL string you'd like to sendpublic long getLastQueryTime()
public java.sql.ResultSet query(java.lang.String queryString) throws java.sql.SQLException
queryString
- SQL query-style stringjava.sql.SQLException
- a sql errorpublic void setPreparedClobs(java.lang.String[] vals) throws java.sql.SQLException
vals
- the strings, in orderjava.sql.SQLException
- a sql errorpublic int update(java.lang.String updateString, int retryNum) throws java.sql.SQLException
updateString
- SQL update-style stringretryNum
- a retry numberjava.sql.SQLException
- a sql errorpublic boolean ready()
public boolean inUse()
public int getRecordCount(java.sql.ResultSet R)
R
- the result setpublic void clearFailures()
public boolean inSQLServerCommunication()
public boolean isProbablyDead()
public boolean isProbablyLockedUp()
public java.lang.String getLastError()
public java.sql.PreparedStatement getPreparedStatement()