edu.ucsb.nceas.metacat
Class DBConnection

java.lang.Object
  extended byedu.ucsb.nceas.metacat.DBConnection

public class DBConnection
extends java.lang.Object

A class represent a connection object, it includes connection itself, index, status, age, createtime, connection time, usageCount, warning message


Constructor Summary
DBConnection()
          Default constructor of the DBConnection class
 
Method Summary
 void close()
          Close a DBConnection object
 void commit()
          Method to make a commit command
 java.sql.Statement createStatement()
          Method to create a Statement
 long getAge()
          get the db connetion age from the object
 java.lang.String getCheckOutMethodName()
          get the the name of method checked out the connection from the object
 int getCheckOutSerialNumber()
          get the check out serial number
 long getCheckOutTime()
          get the when a db connetion was checked out
 java.sql.Connection getConnections()
          get the connetion from the object
 long getConnectionTime()
          get the how long db connetion used for the object
 long getCreateTime()
          get the db connetion created time from the object
 java.sql.DatabaseMetaData getMetaData()
          Method to get meta data
 int getStatus()
          get the db connetion status from the object
 java.lang.String getTag()
          get the db connetion tag from the object
 int getUsageCount()
          get the db connetion usage times from the object
 java.sql.SQLWarning getWarningMessage()
          get the db connetion waring message from the object
 void increaseCheckOutSerialNumber(int myCheckOutSerialNumber)
          Increase a usage number to this object
 void increaseUsageCount(int myUsageCount)
          Increase a usage number to this object
static java.sql.Connection openConnection()
          Method to establish DBConnection
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          Method to create a PreparedStatement by sending a sql statement
 void rollback()
          Method to roll back
 void setAge(long myAge)
          Set a connection age to this object
 void setAutoCommit(boolean autoCommit)
          Method to set commit mode
 void setCheckOutMethodName(java.lang.String myCheckOutMethodName)
          Set a method name to the checkOutMethodName
 void setCheckOutSerialNumber(int myCheckOutSerialNumber)
          Set check out serial number to this object
 void setCheckOutTime(long myCheckOutTime)
          Set check out time to this object
 void setConnections(java.sql.Connection myConnection)
          Set a connection to this object
 void setConnectionTime(long myConnectionTime)
          Set a connection time to this object It is accumulated
 void setCreateTime(long myCreateTime)
          Set a usage number to this object
 void setStatus(int myStatus)
          Set a connection status to this object
 void setTag(java.lang.String myTag)
          Set a connection status to this object
 void setUsageCount(int myUsageCount)
          Set a usage number to this object
 void setWarningMessage(java.sql.SQLWarning myWarningMessage)
          Set a warning message to this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBConnection

public DBConnection()
             throws java.sql.SQLException
Default constructor of the DBConnection class

Method Detail

getConnections

public java.sql.Connection getConnections()
get the connetion from the object


setConnections

public void setConnections(java.sql.Connection myConnection)
Set a connection to this object


getTag

public java.lang.String getTag()
get the db connetion tag from the object


setTag

public void setTag(java.lang.String myTag)
Set a connection status to this object


getStatus

public int getStatus()
get the db connetion status from the object


setStatus

public void setStatus(int myStatus)
Set a connection status to this object


getAge

public long getAge()
get the db connetion age from the object


setAge

public void setAge(long myAge)
Set a connection age to this object


getCreateTime

public long getCreateTime()
get the db connetion created time from the object


setCreateTime

public void setCreateTime(long myCreateTime)
Set a usage number to this object


getConnectionTime

public long getConnectionTime()
get the how long db connetion used for the object


setConnectionTime

public void setConnectionTime(long myConnectionTime)
Set a connection time to this object It is accumulated


getCheckOutTime

public long getCheckOutTime()
get the when a db connetion was checked out


setCheckOutTime

public void setCheckOutTime(long myCheckOutTime)
Set check out time to this object


getUsageCount

public int getUsageCount()
get the db connetion usage times from the object


setUsageCount

public void setUsageCount(int myUsageCount)
Set a usage number to this object


increaseUsageCount

public void increaseUsageCount(int myUsageCount)
Increase a usage number to this object


getCheckOutSerialNumber

public int getCheckOutSerialNumber()
get the check out serial number


setCheckOutSerialNumber

public void setCheckOutSerialNumber(int myCheckOutSerialNumber)
Set check out serial number to this object


increaseCheckOutSerialNumber

public void increaseCheckOutSerialNumber(int myCheckOutSerialNumber)
Increase a usage number to this object


getWarningMessage

public java.sql.SQLWarning getWarningMessage()
                                      throws java.sql.SQLException
get the db connetion waring message from the object

Throws:
java.sql.SQLException

setWarningMessage

public void setWarningMessage(java.sql.SQLWarning myWarningMessage)
Set a warning message to this object


getCheckOutMethodName

public java.lang.String getCheckOutMethodName()
get the the name of method checked out the connection from the object


setCheckOutMethodName

public void setCheckOutMethodName(java.lang.String myCheckOutMethodName)
Set a method name to the checkOutMethodName


close

public void close()
           throws java.sql.SQLException
Close a DBConnection object

Throws:
java.sql.SQLException

openConnection

public static java.sql.Connection openConnection()
                                          throws java.sql.SQLException
Method to establish DBConnection

Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Method to create a PreparedStatement by sending a sql statement

Throws:
java.sql.SQLException

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
Method to create a Statement

Throws:
java.sql.SQLException

commit

public void commit()
            throws java.sql.SQLException
Method to make a commit command

Throws:
java.sql.SQLException

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException
Method to set commit mode

Throws:
java.sql.SQLException

rollback

public void rollback()
              throws java.sql.SQLException
Method to roll back

Throws:
java.sql.SQLException

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
Method to get meta data

Throws:
java.sql.SQLException


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.