public class SqlContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
CAN_STORE_ERROR |
static int |
CAN_STORE_ERROR_MASK |
static int |
CAN_STORE_ERROR_NUMERIC_DECIMAL |
static int |
CAN_STORE_ERROR_NUMERIC_WHOLE |
static int |
CAN_STORE_ERROR_STRING |
static int |
CAN_STORE_OK |
static int |
CAN_STORE_WARNING |
static int |
CAN_STORE_WARNING_MASK |
static int |
CAN_STORE_WARNING_SPACES |
static int |
CAN_STORE_WARNING_TRUNCATION |
static java.lang.String |
CURRENT_SQL_CONNECTION_NAME |
static java.lang.String |
DEFAULT_SQL_CONNECTION_NAME |
static boolean |
implicitTransactions |
Modifier and Type | Method and Description |
---|---|
void |
beginTransaction()
Begin a transaction on the current connection if implicit transactions
are enabled.
|
void |
commit() |
void |
commit(boolean closeCursors) |
java.sql.Connection |
connect(java.lang.String connectionName,
java.lang.Object connectionRef,
java.lang.String driverName,
java.lang.Object username,
java.lang.Object password,
java.lang.Object namingContext)
Establish and track java.sql.Connection object.
|
void |
disconnect()
Disconnect from the current connection.
|
void |
disconnect(java.lang.Object connectionRef)
Disconnect from the given object, either Connection or connection name.
|
void |
disconnectAll()
Disconnect from all managed connections.
|
java.sql.SQLWarning |
executeImmediate(java.sql.Connection connection,
java.lang.String command,
java.lang.Object[] params) |
java.sql.SQLWarning |
executeImmediate(java.sql.Connection connection,
java.lang.String command,
java.lang.Object[] params,
int resultSetType,
int resultSetConcurrency) |
java.sql.Connection |
getConnection()
Get the current connection.
|
java.sql.Connection |
getConnection(java.lang.Object connectionName) |
java.sql.Connection |
getConnection(java.lang.Object transEnv,
java.lang.String connectionName)
Get the named connection from the transaction environment
|
java.sql.Connection |
getConnection(java.lang.String name,
boolean create)
Get the current connection, creating the default one if possible when not
already present and create is true.
|
SqlCursors |
getCursors()
getCursors - return the currently active cursors as SqlCursors
|
static SqlContext |
getInstance() |
java.lang.String |
getPreparedStatement(java.lang.Object name)
getPreparedStatement - return the SQL Prepared Statement
previously save with putPreparedStatement
|
java.lang.Object |
getPreparedStatementObject(java.lang.Object name)
getPreparedStatementObject - return the SQL Prepared Statement Object
previously save with putPreparedStatement
|
static boolean |
isImplicitTransactions() |
static void |
log(java.sql.SQLException e)
Log message.
|
static void |
log(java.lang.String msg)
Log message.
|
static void |
log(java.lang.Throwable t)
Log message.
|
static int |
mapSqlCode(java.sql.SQLException e) |
static java.lang.String |
obtainSqlState(java.sql.SQLException e) |
java.lang.Object |
putPreparedStatement(java.lang.String name,
java.lang.Object value)
putPreparedStatement - save the prepared statement value under name
|
java.lang.Object |
removePreparedStatement(java.lang.Object name)
removePreparedStatement - remove a previously saved prepared statement
|
void |
rollback() |
void |
rollback(boolean closeCursors) |
java.sql.Connection |
setConnection(java.lang.Object connectionRef)
SET CONNECTION TO name SET CONNECTION TO object SET CONNECTION TO NULL
|
java.sql.Connection |
setConnection(java.lang.String connectionName,
java.lang.Object connectionRef) |
void |
setDriverLogMode(int value)
Set by the compiler immediately before setting the connection.
|
static void |
setExplicitTransactions() |
static void |
setImplicitTransactions() |
void |
setLogMode(int value)
Set by the compiler immediately before setting the connection.
|
static void |
setReconnectConnections(boolean disconnectReconnectConnections)
setReconnectConnections
[HCI ticket#2787 mnh 2017-02-23] Due to prior tickets, the ETP
SQL execution world shares JDBC Connections with the COBOL world
(in case an ETP transaction contains COBOL programs that were
not compiled with -out:transaction but still perform EXEC SQL).
|
public static final int CAN_STORE_OK
public static final int CAN_STORE_WARNING_SPACES
public static final int CAN_STORE_WARNING_TRUNCATION
public static final int CAN_STORE_ERROR_NUMERIC_DECIMAL
public static final int CAN_STORE_ERROR_NUMERIC_WHOLE
public static final int CAN_STORE_ERROR_STRING
public static final int CAN_STORE_WARNING
public static final int CAN_STORE_ERROR
public static final int CAN_STORE_WARNING_MASK
public static final int CAN_STORE_ERROR_MASK
public static java.lang.String CURRENT_SQL_CONNECTION_NAME
public static final java.lang.String DEFAULT_SQL_CONNECTION_NAME
public static boolean implicitTransactions
public static SqlContext getInstance()
public void setLogMode(int value)
value
- - the log mode to setpublic void setDriverLogMode(int value)
value
- - the driver log mode to setpublic SqlCursors getCursors()
public java.lang.Object putPreparedStatement(java.lang.String name, java.lang.Object value)
name
- - the name of this prepared statementvalue
- - the SQL Prepared Statement object to savepublic java.lang.Object getPreparedStatementObject(java.lang.Object name)
name
- - the name of the parepared statementpublic java.lang.String getPreparedStatement(java.lang.Object name)
name
- - the name of the prepared statementpublic java.lang.Object removePreparedStatement(java.lang.Object name)
name
- - the name of the prepared statement to removepublic final void beginTransaction() throws java.sql.SQLException
java.sql.SQLException
public final void disconnect() throws java.sql.SQLException
java.sql.SQLException
public final void disconnect(java.lang.Object connectionRef) throws java.sql.SQLException
java.sql.SQLException
public final void disconnectAll() throws java.sql.SQLException
java.sql.SQLException
public final java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
public final java.sql.Connection getConnection(java.lang.String name, boolean create) throws java.sql.SQLException
create
- allow creation of a default connectionjava.sql.SQLException
public final java.sql.Connection getConnection(java.lang.Object connectionName) throws java.sql.SQLException
java.sql.SQLException
public final java.sql.Connection getConnection(java.lang.Object transEnv, java.lang.String connectionName) throws java.sql.SQLException
java.sql.SQLException
public final java.sql.Connection setConnection(java.lang.Object connectionRef) throws java.sql.SQLException
java.sql.SQLException
public final java.sql.Connection setConnection(java.lang.String connectionName, java.lang.Object connectionRef) throws java.sql.SQLException
java.sql.SQLException
public java.sql.Connection connect(java.lang.String connectionName, java.lang.Object connectionRef, java.lang.String driverName, java.lang.Object username, java.lang.Object password, java.lang.Object namingContext) throws java.sql.SQLException
java.sql.SQLException
public static final void setExplicitTransactions()
public static final void setImplicitTransactions()
public static final boolean isImplicitTransactions()
public final void commit() throws java.sql.SQLException
java.sql.SQLException
public final void commit(boolean closeCursors) throws java.sql.SQLException
java.sql.SQLException
public final void rollback() throws java.sql.SQLException
java.sql.SQLException
public final void rollback(boolean closeCursors) throws java.sql.SQLException
java.sql.SQLException
public static final void log(java.lang.String msg)
msg
- public static final void log(java.lang.Throwable t)
t
- public static final void log(java.sql.SQLException e)
e
- public static final java.lang.String obtainSqlState(java.sql.SQLException e)
public static final int mapSqlCode(java.sql.SQLException e)
public java.sql.SQLWarning executeImmediate(java.sql.Connection connection, java.lang.String command, java.lang.Object[] params) throws java.sql.SQLException
java.sql.SQLException
public java.sql.SQLWarning executeImmediate(java.sql.Connection connection, java.lang.String command, java.lang.Object[] params, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
java.sql.SQLException
public static void setReconnectConnections(boolean disconnectReconnectConnections)
disconnectReconnectConnections
- - true, disconnect JDBC Connections
upon program exit; false, re-use those connections and don't disconnect them.