public class DB
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DB.ExtendedDatasource |
Modifier and Type | Field and Description |
---|---|
static javax.sql.DataSource |
datasource
Deprecated.
Use datasources instead
|
protected static java.util.Map<java.lang.String,DB.ExtendedDatasource> |
datasources
The loaded datasource.
|
static java.lang.String |
DEFAULT |
static java.lang.String |
destroyMethod
Deprecated.
Use datasources instead
|
Constructor and Description |
---|
DB() |
Modifier and Type | Method and Description |
---|---|
static void |
close()
Close all the open connections for the current thread.
|
static void |
close(java.lang.String name)
Close an given open connections for the current thread
|
static void |
closeAll()
Close all the open connections for the current thread.
|
static void |
destroy()
Destroy the datasource
|
static void |
destroy(java.lang.String name)
Destroy the datasource
|
static void |
destroyAll()
Destroy all datasources
|
static boolean |
execute(java.lang.String SQL)
Execute an SQL update
|
static boolean |
execute(java.lang.String name,
java.lang.String SQL)
Execute an SQL update
|
static javax.sql.RowSet |
executeQuery(java.lang.String SQL)
Execute an SQL query
|
static javax.sql.RowSet |
executeQuery(java.lang.String name,
java.lang.String SQL)
Execute an SQL query
|
static java.sql.Connection |
getConnection() |
static java.sql.Connection |
getConnection(java.lang.String name)
Open a connection for the current thread.
|
static java.sql.Connection |
getConnection(java.lang.String name,
boolean autocommit) |
static javax.sql.DataSource |
getDataSource() |
static javax.sql.DataSource |
getDataSource(java.lang.String name) |
static void |
safeCloseResultSet(java.sql.ResultSet resultSet) |
static void |
safeCloseStatement(java.sql.Statement statement) |
protected static final java.util.Map<java.lang.String,DB.ExtendedDatasource> datasources
DB.ExtendedDatasource
@Deprecated public static javax.sql.DataSource datasource
datasources
,
DB.ExtendedDatasource
@Deprecated public static java.lang.String destroyMethod
datasources
,
DB.ExtendedDatasource
public static final java.lang.String DEFAULT
public static javax.sql.DataSource getDataSource(java.lang.String name)
public static javax.sql.DataSource getDataSource()
public static java.sql.Connection getConnection(java.lang.String name, boolean autocommit)
public static void closeAll()
public static void close()
public static void close(java.lang.String name)
name
- Name of the DBpublic static java.sql.Connection getConnection(java.lang.String name)
name
- Name of the DBpublic static java.sql.Connection getConnection()
public static boolean execute(java.lang.String name, java.lang.String SQL)
name
- the DB nameSQL
- the SQL statementpublic static boolean execute(java.lang.String SQL)
SQL
- the SQL statementpublic static javax.sql.RowSet executeQuery(java.lang.String SQL)
SQL
- the SQL statementpublic static javax.sql.RowSet executeQuery(java.lang.String name, java.lang.String SQL)
name
- the DB nameSQL
- the SQL statementpublic static void safeCloseResultSet(java.sql.ResultSet resultSet)
public static void safeCloseStatement(java.sql.Statement statement)
public static void destroy(java.lang.String name)
name
- the DB namepublic static void destroy()
public static void destroyAll()
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly