public class DatabaseFactory extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
close(Connection con)
Closes connection and returns it to the pool.
|
static void |
close(PreparedStatement st)
Helper method for silently close PreparedStament object.
|
static void |
close(PreparedStatement st,
Connection con)
Closes both prepared statement and result set
|
int |
getActiveConnections()
Returns number of active connections in the pool.
|
static Connection |
getConnection()
Returns an active connection from pool.
|
static int |
getDatabaseMajorVersion()
Returns database version.
|
static int |
getDatabaseMinorVersion()
Returns database minor version.
|
static String |
getDatabaseName()
Returns database name.
|
int |
getIdleConnections()
Returns number of Idle connections.
|
static void |
init()
Initializes DatabaseFactory.
|
static void |
shutdown()
Shuts down pool and closes connections
|
public static void init()
public static Connection getConnection() throws SQLException
SQLException - if can't get connectionpublic int getActiveConnections()
public int getIdleConnections()
public static void shutdown()
public static void close(PreparedStatement st, Connection con)
st - prepared statement to closecon - connection to closepublic static void close(PreparedStatement st)
st - prepared statement to closepublic static void close(Connection con)
con - Connection object to close, can be nullpublic static String getDatabaseName()
public static int getDatabaseMajorVersion()
public static int getDatabaseMinorVersion()
Copyright © 2014–2015. All rights reserved.