|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.gotoandplay.smartfoxserver.db.DbManager
public class DbManager
The DbManager class manages the connection to a database using either JDBC native drivers or JDBC-ODBC bridge.
Additionally it provides configurable connection pooling for optimal performance and resource usage.
Each Zone has its own DbManager which can be configured directly in the main config.xml file. More details about how to configure the database connection are found in chapter 6.3 of our documentation
| Constructor Summary | |
|---|---|
DbManager(java.lang.String driverName,
java.lang.String connStr,
java.lang.String usrName,
java.lang.String pword,
java.lang.String zoneName,
int maxActive,
int maxIdle,
java.lang.String exhaustedAction,
int blockTime)
Creates a new, pooled DbManager object For further details check this page |
|
| Method Summary | |
|---|---|
boolean |
executeCommand(java.lang.String cmd)
Executes any non-SELECT SQL commands (INSERT, UPDATE, DELETE etc...) |
java.util.ArrayList |
executeQuery(java.lang.String cmd)
Executes a SQL query (SELECT) and returns an ArrayList of DataRows where each column can be referenced with the field name |
java.util.ArrayList |
executeQuery(java.lang.String cmd,
int keyType)
Executes a SQL query (SELECT) and returns an ArrayList of DataRows where each column can be referenced by its field name or numeric index (starting from zero) |
java.sql.Connection |
getConnection()
Grab a connection from the connection pool This allows the extension developer to freely instantiate a db connection and use all the objects exposed by the JDBC APIs. |
void |
shutDown()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DbManager(java.lang.String driverName,
java.lang.String connStr,
java.lang.String usrName,
java.lang.String pword,
java.lang.String zoneName,
int maxActive,
int maxIdle,
java.lang.String exhaustedAction,
int blockTime)
driverName - the database driver name (must be in the classpath)connStr - the connection stringusrName - the user name for the connectionpword - the passwordzoneName - the name of the Zone which owns this objectmaxActive - max. active connections in the poolmaxIdle - max. idle connectionsexhaustedAction - what to do if the pool fails to retrieve a connection (grow, wait, fail)blockTime - how much time to wait if wait is chosen for the above option| Method Detail |
|---|
public java.sql.Connection getConnection()
public java.util.ArrayList executeQuery(java.lang.String cmd)
cmd - any valid SQL SELECT command
DataRow
public java.util.ArrayList executeQuery(java.lang.String cmd,
int keyType)
cmd - any valid SQL SELECT commandkeyType - accepts DataRow.DATAROW_INTKEY or DataRow.DATAROW_STRINGKEY
public boolean executeCommand(java.lang.String cmd)
cmd - the SQL command
public void shutDown()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||