|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opensha.sha.cybershake.db.DBAccess
public class DBAccess
DbConnectionBroker A servlet-based broker for database connections. Creates and manages a pool of database connections.
| Field Summary | |
|---|---|
static SimpleDateFormat |
SQL_DATE_FORMAT
|
| Constructor Summary | |
|---|---|
DBAccess(String hostname,
String dbName)
Class default constructor Creates a new Connection Broker after reading the JDBC info from the data file. |
|
DBAccess(String hostname,
String dbName,
String user,
String pass)
Class default constructor Creates a new Connection Broker after reading the JDBC info from the data file. |
|
DBAccess(String dbDriver,
String dbServer,
String dbLogin,
String dbPassword,
int minConns,
int maxConns,
String logFileString,
double maxConnTime)
Creates a new Connection Broker dbDriver: JDBC driver. |
|
DBAccess(String dbDriver,
String dbServer,
String dbLogin,
String dbPassword,
int minConns,
int maxConns,
String logFileString,
double maxConnTime,
boolean logAppend)
|
|
DBAccess(String dbDriver,
String dbServer,
String dbLogin,
String dbPassword,
int minConns,
int maxConns,
String logFileString,
double maxConnTime,
boolean logAppend,
int maxCheckoutSeconds,
int debugLevel)
|
|
| Method Summary | |
|---|---|
static DBAccess |
createWithAuthDialog(String host,
String dbName)
|
void |
destroy()
Less safe shutdown. |
void |
destroy(int millis)
Multi-phase shutdown. |
String |
freeConnection(Connection conn)
Frees a connection. |
long |
getAge(Connection conn)
Returns the age of a connection -- the time since it was handed out to an application. |
Connection |
getConnection()
This method hands out the connections in round-robin order. |
int |
getSize()
Returns the number of connections in the dynamic pool. |
int |
getUseCount()
Returns the number of connections in use. |
int |
idOfConnection(Connection conn)
Returns the local JDBC ID for a connection. |
int |
insertUpdateOrDeleteData(String query)
Inserts the data into the database |
boolean |
isReadOnly()
|
void |
run()
Housekeeping thread. |
ResultSet |
selectData(String sql)
Runs the select query on the database |
void |
setReadOnly(boolean readOnly)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final SimpleDateFormat SQL_DATE_FORMAT
| Constructor Detail |
|---|
public DBAccess(String hostname,
String dbName)
public DBAccess(String hostname,
String dbName,
String user,
String pass)
throws IOException
IOException
public DBAccess(String dbDriver,
String dbServer,
String dbLogin,
String dbPassword,
int minConns,
int maxConns,
String logFileString,
double maxConnTime)
throws IOException
IOException
public DBAccess(String dbDriver,
String dbServer,
String dbLogin,
String dbPassword,
int minConns,
int maxConns,
String logFileString,
double maxConnTime,
boolean logAppend)
throws IOException
IOException
public DBAccess(String dbDriver,
String dbServer,
String dbLogin,
String dbPassword,
int minConns,
int maxConns,
String logFileString,
double maxConnTime,
boolean logAppend,
int maxCheckoutSeconds,
int debugLevel)
throws IOException
IOException| Method Detail |
|---|
public boolean isReadOnly()
public void setReadOnly(boolean readOnly)
public static DBAccess createWithAuthDialog(String host,
String dbName)
throws IOException
IOExceptionpublic void run()
run in interface Runnablepublic Connection getConnection()
public int idOfConnection(Connection conn)
public String freeConnection(Connection conn)
public long getAge(Connection conn)
public void destroy(int millis)
throws SQLException
getConnection() will refuse to return connections.
millis milliseconds after shutdown of
the housekeeping thread, freeConnection() can still be
called to return used connections.
millis milliseconds after the shutdown of the
housekeeping thread, all connections in the pool are closed.
SQLException is thrown.
millis - the time to wait in milliseconds.
SQLException - if connections were in use after
millis.public void destroy()
destroy() method
with a millis
value of 10000 (10 seconds) and ignores SQLException
thrown by that method.
destroy(int)public int getUseCount()
public int getSize()
public int insertUpdateOrDeleteData(String query)
throws SQLException
query -
SQLException
public ResultSet selectData(String sql)
throws SQLException
query -
SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||