org.apache.derby.impl.drda
Class Database

java.lang.Object
  extended byorg.apache.derby.impl.drda.Database

class Database
extends java.lang.Object

Database stores information about the current database It is used so that a session may have more than one database


Field Summary
protected  int accessCount
           
protected  int byteOrder
           
protected  int ccsidDBC
           
protected  java.lang.String ccsidDBCEncoding
           
protected  int ccsidMBC
           
protected  java.lang.String ccsidMBCEncoding
           
protected  int ccsidSBC
           
protected  java.lang.String ccsidSBCEncoding
           
private  java.sql.Connection conn
           
protected  byte[] crrtkn
           
private  DRDAStatement currentStatement
           
protected  java.lang.String dbName
           
protected  java.lang.String decryptedPassword
           
protected  java.lang.String decryptedUserId
           
private  DRDAStatement defaultStatement
           
protected  java.lang.String password
           
protected  byte[] publicKeyIn
           
protected  byte[] publicKeyOut
           
protected  boolean rdbAllowUpdates
           
protected  boolean RDBUPDRM_sent
           
protected  int securityMechanism
           
protected  boolean sendTRGDFTRT
           
private  java.util.Hashtable stmtTable
           
protected  java.lang.String typDefNam
           
protected  java.lang.String userId
           
 
Constructor Summary
protected Database(java.lang.String dbName)
          Database constructor
 
Method Summary
protected  java.lang.String buildRuntimeInfo(java.lang.String indent, LocalizedResource localLangUtil)
           
protected  void close()
          Close the connection and clean up the statement table
protected  void commit()
           
protected  java.sql.Connection getConnection()
          Get the connection
protected  DRDAStatement getCurrentStatement()
          Get current DRDA statement
protected  DRDAStatement getDefaultStatement()
          Get default statement for use in EXCIMM
protected  DRDAStatement getDefaultStatement(java.lang.String pkgnamcsn)
          Get default statement for use in EXCIMM with specified pkgnamcsn The pkgnamcsn has the encoded isolation level
protected  DRDAStatement getDRDAStatement(java.lang.String pkgnamcsn)
          Get DRDA statement based on pkgnamcsn
protected  java.sql.PreparedStatement getPreparedStatement(java.lang.String pkgnamcsn)
          Get prepared statement based on pkgnamcsn
protected  int getPrepareIsolation()
           
protected  java.sql.ResultSet getResultSet(java.lang.String pkgnamcsn)
          Get result set
private  java.lang.String getStmtKey(java.lang.String pkgnamcsn)
           
protected  DRDAStatement newDRDAStatement(java.lang.String pkgnamcsn)
          Get a new DRDA statement and store it in the stmtTable if stortStmt is true If possible recycle an existing statement If we are asking for one with the same name it means it was already closed.
protected  void removeStatement(DRDAStatement stmt)
           
protected  void rollback()
           
protected  void setConnection(java.sql.Connection conn)
          Set connection and create the SQL statement for the default statement
protected  void setCurrentStatement(DRDAStatement stmt)
          Make statement the current statement
protected  void setPrepareIsolation(int level)
          Set the internal isolation level to use for preparing statements.
protected  void setResultSet(java.sql.ResultSet value)
          Set result set
protected  void storeStatement(DRDAStatement stmt)
          Store DRDA prepared statement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbName

protected java.lang.String dbName

securityMechanism

protected int securityMechanism

userId

protected java.lang.String userId

password

protected java.lang.String password

decryptedUserId

protected java.lang.String decryptedUserId

decryptedPassword

protected java.lang.String decryptedPassword

rdbAllowUpdates

protected boolean rdbAllowUpdates

accessCount

protected int accessCount

publicKeyIn

protected byte[] publicKeyIn

publicKeyOut

protected byte[] publicKeyOut

crrtkn

protected byte[] crrtkn

typDefNam

protected java.lang.String typDefNam

byteOrder

protected int byteOrder

ccsidSBC

protected int ccsidSBC

ccsidDBC

protected int ccsidDBC

ccsidMBC

protected int ccsidMBC

ccsidSBCEncoding

protected java.lang.String ccsidSBCEncoding

ccsidDBCEncoding

protected java.lang.String ccsidDBCEncoding

ccsidMBCEncoding

protected java.lang.String ccsidMBCEncoding

RDBUPDRM_sent

protected boolean RDBUPDRM_sent

sendTRGDFTRT

protected boolean sendTRGDFTRT

conn

private java.sql.Connection conn

defaultStatement

private DRDAStatement defaultStatement

currentStatement

private DRDAStatement currentStatement

stmtTable

private java.util.Hashtable stmtTable
Constructor Detail

Database

protected Database(java.lang.String dbName)
Database constructor

Parameters:
dbName - database name
Method Detail

setConnection

protected void setConnection(java.sql.Connection conn)
                      throws java.sql.SQLException
Set connection and create the SQL statement for the default statement

Parameters:
conn - Connection
Throws:
java.sql.SQLException

getConnection

protected java.sql.Connection getConnection()
Get the connection

Returns:
connection

getCurrentStatement

protected DRDAStatement getCurrentStatement()
Get current DRDA statement

Returns:
DRDAStatement
Throws:
java.sql.SQLException

getDefaultStatement

protected DRDAStatement getDefaultStatement()
Get default statement for use in EXCIMM

Returns:
DRDAStatement

getDefaultStatement

protected DRDAStatement getDefaultStatement(java.lang.String pkgnamcsn)
Get default statement for use in EXCIMM with specified pkgnamcsn The pkgnamcsn has the encoded isolation level

Parameters:
pkgnamcsn - package/ section # for statement
Returns:
DRDAStatement

getPreparedStatement

protected java.sql.PreparedStatement getPreparedStatement(java.lang.String pkgnamcsn)
                                                   throws java.sql.SQLException
Get prepared statement based on pkgnamcsn

Parameters:
pkgnamcsn - - key to access statement
Returns:
prepared statement
Throws:
java.sql.SQLException

newDRDAStatement

protected DRDAStatement newDRDAStatement(java.lang.String pkgnamcsn)
                                  throws java.sql.SQLException
Get a new DRDA statement and store it in the stmtTable if stortStmt is true If possible recycle an existing statement If we are asking for one with the same name it means it was already closed.

Parameters:
pkgnamcsn - Package name and section
Returns:
DRDAStatement
Throws:
java.sql.SQLException

getDRDAStatement

protected DRDAStatement getDRDAStatement(java.lang.String pkgnamcsn)
                                  throws java.sql.SQLException
Get DRDA statement based on pkgnamcsn

Parameters:
pkgnamcsn - - key to access statement
Returns:
DRDAStatement
Throws:
java.sql.SQLException

getResultSet

protected java.sql.ResultSet getResultSet(java.lang.String pkgnamcsn)
                                   throws java.sql.SQLException
Get result set

Parameters:
pkgnamcsn - - key to access prepared statement
Returns:
result set
Throws:
java.sql.SQLException

setResultSet

protected void setResultSet(java.sql.ResultSet value)
                     throws java.sql.SQLException
Set result set

Parameters:
value -
Throws:
java.sql.SQLException

storeStatement

protected void storeStatement(DRDAStatement stmt)
                       throws java.sql.SQLException
Store DRDA prepared statement

Parameters:
stmt - DRDA prepared statement
Throws:
java.sql.SQLException

removeStatement

protected void removeStatement(DRDAStatement stmt)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

setCurrentStatement

protected void setCurrentStatement(DRDAStatement stmt)
Make statement the current statement

Parameters:
stmt -

commit

protected void commit()
               throws java.sql.SQLException
Throws:
java.sql.SQLException

rollback

protected void rollback()
                 throws java.sql.SQLException
Throws:
java.sql.SQLException

close

protected void close()
              throws java.sql.SQLException
Close the connection and clean up the statement table

Throws:
java.sql.SQLException - on conn.close() error to be handled in DRDAConnThread.

setPrepareIsolation

protected void setPrepareIsolation(int level)
                            throws java.sql.SQLException
Set the internal isolation level to use for preparing statements. Subsequent prepares will use this isoalation level

Throws:
java.sql.SQLException
See Also:
EmbedConnection.setPrepareIsolation(int)

getPrepareIsolation

protected int getPrepareIsolation()
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

buildRuntimeInfo

protected java.lang.String buildRuntimeInfo(java.lang.String indent,
                                            LocalizedResource localLangUtil)

getStmtKey

private java.lang.String getStmtKey(java.lang.String pkgnamcsn)


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.