|
Sun Adapter for DB2 Connect | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.stc.connector.db2connectadapter.base.SessionImpl
public class SessionImpl
Session hosts a Connection interface.
Field Summary | |
---|---|
protected boolean |
bSupportsBatch
Indicator for the driver support of batch processing. |
protected java.sql.Connection |
conn
A Connection instance to the database. |
protected javax.sql.DataSource |
dataSource
A DataSource instance used for creating database connection. |
protected int |
dbms
Database type. |
protected java.sql.DatabaseMetaData |
dmd
A database metadata instance for discovering database information. |
protected boolean |
isConnected
|
protected java.lang.String |
password
Password for database login. |
protected java.util.Vector |
sessionEventListeners
A vector of Session event listners. |
protected java.sql.SQLException |
sqlException
A SQLException instance used to hold the last exception. |
protected java.lang.String |
userName
User name for database login. |
Fields inherited from interface com.stc.connector.db.Session |
---|
DBMS_TYPE_UNKNOWN |
Constructor Summary | |
---|---|
SessionImpl(javax.sql.DataSource dataSource,
java.lang.String userName,
java.lang.String password)
SessionImpl constructor. |
Method Summary | |
---|---|
java.sql.Connection |
addSessionEventListener(com.stc.connector.db.SessionEventListener listener)
Adds sessoin event listener. |
void |
checkConnection(java.sql.SQLException sqlException)
Connection status check if there is a SQL exception. |
void |
close()
Closes the session. |
void |
commit()
Commits a transaction for the connection. |
void |
connect()
Connects to a database. |
java.lang.Object |
connInvoke(java.lang.String methodName,
java.lang.Class[] argsCls,
java.lang.Object[] args)
Invokes a method of the database Connection object of this ETD. |
boolean |
getAutoCommit()
Returns the session auto commit property. |
java.lang.String |
getCatalog()
Returns the session catalog property. |
int |
getConcurrencyType()
Get concurrency type. |
java.sql.Connection |
getConnection()
Get the database Connection object of this ETD. |
int |
getDBMS()
Retrieves the DBMS type. |
java.sql.DatabaseMetaData |
getMetaData()
Returns the session database meta data. |
boolean |
getNewTypeFlag()
Check if it is a new ResultSet type. |
int |
getResultSetType()
Get result set type. |
boolean |
getSupportsBatch()
checks to see if the driver supports batch operations. |
int |
getTransactionIsolation()
Returns the session transaction isolation level. |
java.util.Map |
getTypeMap()
Returns the session type map for user-defined type. |
protected void |
inValidateConnection(java.sql.SQLException sqle)
Sets the flag inside JDBC Connector for invalid connection when an exception occurs. |
boolean |
isClosed()
Returns the session open status. |
boolean |
isConnected()
Returns the connection status. |
boolean |
isReadOnly()
Returns the session read only status. |
void |
open()
Opens the session. |
void |
releaseResources()
Releases connection resources. |
boolean |
removeSessionEventListener(com.stc.connector.db.SessionEventListener listener)
Removes sessoin event listener. |
void |
requestReset()
Request that a reset be done on the data content of the DB ETD. |
void |
rollback()
Rollbacks a transaction for the connection. |
void |
setAutoCommit(boolean bAuto)
Sets the session auto commit property. |
void |
setCatalog(java.lang.String sCatalog)
Sets the session catalog property. |
void |
setConcurrencyType(int concurrencyType)
Set the concurrency type of the connection. |
void |
setDBMS(int dbmsType)
Sets the DBMS type. |
void |
setNewTypeFlag(boolean bNew)
Set whether this is a new ResultSet type. |
void |
setReadOnly(boolean bRead)
Sets the session read only property. |
void |
setResultSetType(int resultSetType)
Set the resultset type of the connection. |
void |
setTransactionIsolation(int iLevel)
Sets the session transaction isolation level. |
void |
setTypeMap(java.util.Map map)
Sets the session type map for user-defined type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.sql.DataSource dataSource
protected java.sql.Connection conn
protected java.sql.DatabaseMetaData dmd
protected java.sql.SQLException sqlException
protected java.lang.String userName
protected java.lang.String password
protected int dbms
protected java.util.Vector sessionEventListeners
protected boolean bSupportsBatch
protected boolean isConnected
Constructor Detail |
---|
public SessionImpl(javax.sql.DataSource dataSource, java.lang.String userName, java.lang.String password)
dataSource
- a DataSource instance used to create a connection.userName
- user name for login.password
- password for login.Method Detail |
---|
public void connect() throws java.sql.SQLException
connect
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public void open() throws java.sql.SQLException
open
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public void releaseResources() throws java.sql.SQLException
releaseResources
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public void close() throws java.sql.SQLException
close
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public boolean isClosed() throws java.sql.SQLException
isClosed
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public boolean getAutoCommit() throws java.sql.SQLException
getAutoCommit
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public void setAutoCommit(boolean bAuto) throws java.sql.SQLException
setAutoCommit
in interface com.stc.connector.db.Session
bAuto
- true if auto commit is desired;false otherwise.
java.sql.SQLException
- when SQL problems occur.public java.lang.String getCatalog() throws java.sql.SQLException
getCatalog
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public void setCatalog(java.lang.String sCatalog) throws java.sql.SQLException
setCatalog
in interface com.stc.connector.db.Session
sCatalog
- the desired name of the catalog.
java.sql.SQLException
- when SQL problems occur.public boolean isReadOnly() throws java.sql.SQLException
isReadOnly
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public void setReadOnly(boolean bRead) throws java.sql.SQLException
setReadOnly
in interface com.stc.connector.db.Session
bRead
- true if read-only operations are desired; false otherwise.
java.sql.SQLException
- when SQL problems occur.public java.util.Map getTypeMap() throws java.sql.SQLException
getTypeMap
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public void setTypeMap(java.util.Map map) throws java.sql.SQLException
setTypeMap
in interface com.stc.connector.db.Session
map
- the Map object that contains the mapping from SQL type names
for user-defined types to Java classes.
java.sql.SQLException
- when SQL problems occur.public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
getMetaData
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public int getTransactionIsolation() throws java.sql.SQLException
getTransactionIsolation
in interface com.stc.connector.db.Session
java.sql.SQLException
- when SQL problems occur.public void setTransactionIsolation(int iLevel) throws java.sql.SQLException
setTransactionIsolation
in interface com.stc.connector.db.Session
iLevel
- a transaction isolation value: TRANSACTION_NONE,
TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED,
TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE.
java.sql.SQLException
- when SQL problems occur.public void commit() throws java.sql.SQLException
commit
in interface com.stc.connector.db.Session
java.sql.SQLException
- if there is any problem in commiting a transaction.public void rollback() throws java.sql.SQLException
rollback
in interface com.stc.connector.db.Session
java.sql.SQLException
- if there is any problem in rolling back a transaction.public java.sql.Connection addSessionEventListener(com.stc.connector.db.SessionEventListener listener)
addSessionEventListener
in interface com.stc.connector.db.Session
listener
- a StatmentAgent that wants to be notified
when a Session event occurs.
public boolean removeSessionEventListener(com.stc.connector.db.SessionEventListener listener)
removeSessionEventListener
in interface com.stc.connector.db.Session
listener
- a StatmentAgent that no longer will be notified
when a Session event occurs.
public void checkConnection(java.sql.SQLException sqlException) throws java.sql.SQLException
checkConnection
in interface com.stc.connector.db.Session
sqlException
- a SQLException instance.
java.sql.SQLException
- when SQL problems occur.public void setDBMS(int dbmsType) throws java.sql.SQLException
setDBMS
in interface com.stc.connector.db.Session
dbmsType
- the database vendor type.
java.sql.SQLException
- if there is any SQL problem.public int getDBMS()
getDBMS
in interface com.stc.connector.db.Session
Session.DBMS_TYPE_UNKNOWN
,
#DBMS_TYPE_ORACLE
,
#DBMS_TYPE_SYBASE
,
#DBMS_TYPE_MSSQL
,
#DBMS_TYPE_DB2
,
#DBMS_TYPE_SEQUELINK
,
#DBMS_TYPE_ATTUNITY
public boolean getSupportsBatch()
getSupportsBatch
in interface com.stc.connector.db.Session
public void requestReset()
requestReset
in interface com.stc.connector.db.Session
public java.lang.Object connInvoke(java.lang.String methodName, java.lang.Class[] argsCls, java.lang.Object[] args) throws java.lang.Exception
Connection
object of this ETD.
connInvoke
in interface com.stc.connector.db.Session
methodName
- the name of the methodargsCls
- Class
array for types of formal arguments for method,
in the declared order. Can be null
if there are no
formal arguments. However, cannot invoke constructor here.args
- Object
array of formal arguments for method in the
declared order. Can be null
if there are no formal
arguments. However, cannot invoke constructor here.
Object
instance resulting from the method invocation. Can be
null
if nothing is returned (void
return declaration).
java.lang.Exception
- whatever exception the invoked method throws.public java.sql.Connection getConnection()
Connection
object of this ETD.
getConnection
in interface com.stc.connector.db.Session
Connection
object of this ETD.public void setResultSetType(int resultSetType)
setResultSetType
in interface com.stc.connector.db.Session
resultSetType
- resultset can have the following types:
TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE,
TYPE_SCROLL_SENSITIVE.public int getResultSetType()
getResultSetType
in interface com.stc.connector.db.Session
public void setConcurrencyType(int concurrencyType)
setConcurrencyType
in interface com.stc.connector.db.Session
concurrencyType
- concurrency can have the following types:
CONCUR_READ_ONLY, CONCUR_UPDATABLEpublic int getConcurrencyType()
getConcurrencyType
in interface com.stc.connector.db.Session
public void setNewTypeFlag(boolean bNew)
setNewTypeFlag
in interface com.stc.connector.db.Session
bNew
- a boolean value to indicate if the ResultSet type is modified.public boolean getNewTypeFlag()
getNewTypeFlag
in interface com.stc.connector.db.Session
public boolean isConnected()
isConnected
in interface com.stc.connector.db.Session
protected void inValidateConnection(java.sql.SQLException sqle)
|
Sun Adapter for DB2 Connect | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |