EspressReport 6.6

quadbase.reportdesigner.ReportAPI
Class DBInfo

java.lang.Object
  extended by quadbase.common.util.internal.DBInfoBasic
      extended by quadbase.reportdesigner.ReportAPI.DBInfo
All Implemented Interfaces:
quadbase.common.util.IDatabaseInfo, quadbase.common.util.IJNDIDatabaseInfo
Direct Known Subclasses:
SimpleQueryFileInfo

public class DBInfo
extends quadbase.common.util.internal.DBInfoBasic
implements IDatabaseInfo

DBInfo

This class provides an implementation for the quadbase.reportdesigner.util.IDatabaseInfo interface. It stores information necessary to retrieve data from a database.

See Also:
IDatabaseInfo

Field Summary
 
Fields inherited from class quadbase.common.util.internal.DBInfoBasic
additionalDb, connection, doNotCloseConnection, driver, env, info, JNDIName, query, tableNameFormat, url, useJNDIDataSource, XMLTAG
 
Fields inherited from interface quadbase.common.util.IDatabaseInfo
DB_DRIVER_ACCESS, DB_DRIVER_DB2, DB_DRIVER_HSQL, DB_DRIVER_INFORMIX, DB_DRIVER_JTDS, DB_DRIVER_MSSSQL, DB_DRIVER_MYSQL, DB_DRIVER_ORACLE, DB_DRIVER_POINTBASE, DB_DRIVER_POSTGRESQL
 
Constructor Summary
DBInfo(java.sql.Connection conn, java.lang.String query)
          Create a new instance of DBInfo using the given Connection object
DBInfo(java.sql.Connection conn, java.lang.String query, java.applet.Applet applet)
          Deprecated.  
DBInfo(quadbase.common.util.IDatabaseInfo dbInfo)
          Create a new instance of DBInfo
DBInfo(java.lang.String JNDIName, java.lang.String query, java.util.Hashtable<java.lang.String,java.lang.String> env)
          Create a new instance of DBInfo
DBInfo(java.lang.String url, java.lang.String driver, java.lang.String username, java.lang.String password, java.lang.String query)
          Create a new instance of DbInfo
DBInfo(java.lang.String url, java.lang.String driver, java.lang.String username, java.lang.String password, java.lang.String query, java.applet.Applet applet)
          Deprecated.  
DBInfo(java.lang.String url, java.lang.String driver, java.lang.String username, java.lang.String password, java.lang.String query, java.util.Vector<java.lang.String> additionalDb)
          Create a new instance of DbInfo
 
Method Summary
 void closeConnection()
          internal use only This function closes the connection to the database
 boolean establishConnection()
          internal use only This function establishes a connection to the database specified by the url string
 DbData fetchData()
          Get the data from database, return as instance of DbData ClassNotFoundException is thrown if JDBC driver not found.
static quadbase.reportdesigner.report.ColData[] getColData(quadbase.common.util.IDatabaseInfo dbInfo, boolean isSpreadSheet, boolean[] transposeCol, int startIndex, int displayRow)
          Retrieves data in column form using the database information provided.
static quadbase.reportdesigner.report.ColData[] getColData(quadbase.common.util.IDatabaseInfo dbInfo, boolean isSpreadSheet, boolean[] transposeCol, int startIndex, int displayRow, boolean optimizeMemory)
          Retrieves data in column form using the database information provided.
 java.sql.Connection getConnection()
          Gets the connection object, if one exists
static java.sql.Connection getDatabaseConnection(java.lang.String JNDIName, java.util.Hashtable<java.lang.String,java.lang.String> env)
          This static function establishes a connection to the specified database and returns a connection object to it.
static java.sql.Connection getDatabaseConnection(java.lang.String driverName, java.lang.String urlString, java.lang.String userName, java.lang.String passwd)
          This static function establishes a connection to the specified database and returns a connection object to it.
 java.lang.String getDriverName()
          Gets the JDBC driver name
 java.util.Hashtable<java.lang.String,java.lang.String> getEnvProperties()
          Gets environment properties for initial context
 java.lang.String getJNDIName()
          Gets the JNDI lookup name of the data base
 java.lang.String getPassword()
          Gets the password
 java.lang.String getQuery()
          Get the SQL query
 java.lang.String getURLString()
          Gets the URL of database
 java.lang.String getUserID()
          Get the user name
 boolean isUseJNDIDataSource()
          Returns if the DBInfo is use JNDI DataSource
 void setConnection(java.sql.Connection conn)
          This function sets the connection field in this object.
 void setDriverName(java.lang.String driver)
          Sets the JDBC driver name
 void setEnvProperties(java.util.Hashtable<java.lang.String,java.lang.String> env)
          Sets environment properties for initial context
 void setJNDIName(java.lang.String name)
          Sets the JNDI lookup name
 void setPassword(java.lang.String password)
          Set the password
 void setQuery(java.lang.String query)
          Set the SQL query
 void setURLString(java.lang.String url)
          Sets the URL of database
 void setUseJNDIDataSource(boolean b)
          Sets if use JNDI DataSource
 void setUserID(java.lang.String username)
          Sets the user name
 
Methods inherited from class quadbase.common.util.internal.DBInfoBasic
clone, equals, equals, equalsIgnoreQuery, getAdditionalDb, getContextFactory, getProviderURL, getTableNameFormat, isCloseConnectionEnabled, openConnection, read, readXML, setAdditionalDb, setTableNameFormat, toString, write, writeXML
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DBInfo

@Deprecated
public DBInfo(java.lang.String url,
                         java.lang.String driver,
                         java.lang.String username,
                         java.lang.String password,
                         java.lang.String query,
                         java.applet.Applet applet)
Deprecated. 

Create a new instance of DbInfo

Parameters:
url - URL of database in form of jdbc:databaseName://machineName(or IPaddress)/schemeName
driver - JDBC driver class name use
username - login user name
password - login password
query - SQL query to retrieve data from database
applet - an applet or null if the program is an application

DBInfo

public DBInfo(java.lang.String url,
              java.lang.String driver,
              java.lang.String username,
              java.lang.String password,
              java.lang.String query)
Create a new instance of DbInfo

Parameters:
url - URL of database in form of jdbc:databaseName://machineName(or IPaddress)/schemeName
driver - JDBC driver class name use
username - login user name
password - login password
query - SQL query to retrieve data from database

DBInfo

public DBInfo(java.lang.String url,
              java.lang.String driver,
              java.lang.String username,
              java.lang.String password,
              java.lang.String query,
              java.util.Vector<java.lang.String> additionalDb)
Create a new instance of DbInfo

Parameters:
url - URL of database in form of jdbc:databaseName://machineName(or IPaddress)/schemeName
driver - JDBC driver class name use
username - login user name
password - login password
query - SQL query to retrieve data from database

DBInfo

public DBInfo(java.lang.String JNDIName,
              java.lang.String query,
              java.util.Hashtable<java.lang.String,java.lang.String> env)
Create a new instance of DBInfo

Parameters:
JNDIName - JNDI lookup name for the data base
query - SQL query to retrieve data from data base
env - Environment properties for the initial context

DBInfo

public DBInfo(quadbase.common.util.IDatabaseInfo dbInfo)
Create a new instance of DBInfo

Parameters:
dbInfo - Another DBInfoURL of database in form of

DBInfo

@Deprecated
public DBInfo(java.sql.Connection conn,
                         java.lang.String query,
                         java.applet.Applet applet)
Deprecated. 

Create a new instance of DBInfo using the given Connection object

Parameters:
conn - a connection to the database
query - SQL query to retrieve data from database
applet - the parent applet

DBInfo

public DBInfo(java.sql.Connection conn,
              java.lang.String query)
Create a new instance of DBInfo using the given Connection object

Parameters:
conn - a connection to the database
query - SQL query to retrieve data from database
Method Detail

getURLString

public java.lang.String getURLString()
Gets the URL of database

Specified by:
getURLString in interface quadbase.common.util.IDatabaseInfo
Overrides:
getURLString in class quadbase.common.util.internal.DBInfoBasic

getDriverName

public java.lang.String getDriverName()
Gets the JDBC driver name

Specified by:
getDriverName in interface quadbase.common.util.IDatabaseInfo
Overrides:
getDriverName in class quadbase.common.util.internal.DBInfoBasic

getUserID

public java.lang.String getUserID()
Get the user name

Specified by:
getUserID in interface quadbase.common.util.IDatabaseInfo
Overrides:
getUserID in class quadbase.common.util.internal.DBInfoBasic

getPassword

public java.lang.String getPassword()
Gets the password

Specified by:
getPassword in interface quadbase.common.util.IDatabaseInfo
Overrides:
getPassword in class quadbase.common.util.internal.DBInfoBasic

getQuery

public java.lang.String getQuery()
Get the SQL query

Specified by:
getQuery in interface quadbase.common.util.IDatabaseInfo
Specified by:
getQuery in interface quadbase.common.util.IJNDIDatabaseInfo
Overrides:
getQuery in class quadbase.common.util.internal.DBInfoBasic

getConnection

public java.sql.Connection getConnection()
Gets the connection object, if one exists

Specified by:
getConnection in interface quadbase.common.util.IDatabaseInfo
Specified by:
getConnection in interface quadbase.common.util.IJNDIDatabaseInfo
Overrides:
getConnection in class quadbase.common.util.internal.DBInfoBasic

getJNDIName

public java.lang.String getJNDIName()
Gets the JNDI lookup name of the data base

Specified by:
getJNDIName in interface quadbase.common.util.IJNDIDatabaseInfo
Overrides:
getJNDIName in class quadbase.common.util.internal.DBInfoBasic

isUseJNDIDataSource

public boolean isUseJNDIDataSource()
Returns if the DBInfo is use JNDI DataSource

Overrides:
isUseJNDIDataSource in class quadbase.common.util.internal.DBInfoBasic

getEnvProperties

public java.util.Hashtable<java.lang.String,java.lang.String> getEnvProperties()
Gets environment properties for initial context

Specified by:
getEnvProperties in interface quadbase.common.util.IJNDIDatabaseInfo
Overrides:
getEnvProperties in class quadbase.common.util.internal.DBInfoBasic

setURLString

public void setURLString(java.lang.String url)
Sets the URL of database

Overrides:
setURLString in class quadbase.common.util.internal.DBInfoBasic

setDriverName

public void setDriverName(java.lang.String driver)
Sets the JDBC driver name

Overrides:
setDriverName in class quadbase.common.util.internal.DBInfoBasic

setUserID

public void setUserID(java.lang.String username)
Sets the user name

Overrides:
setUserID in class quadbase.common.util.internal.DBInfoBasic

setPassword

public void setPassword(java.lang.String password)
Set the password

Overrides:
setPassword in class quadbase.common.util.internal.DBInfoBasic

setQuery

public void setQuery(java.lang.String query)
Set the SQL query

Overrides:
setQuery in class quadbase.common.util.internal.DBInfoBasic

setJNDIName

public void setJNDIName(java.lang.String name)
Sets the JNDI lookup name

Overrides:
setJNDIName in class quadbase.common.util.internal.DBInfoBasic

setUseJNDIDataSource

public void setUseJNDIDataSource(boolean b)
Sets if use JNDI DataSource

Overrides:
setUseJNDIDataSource in class quadbase.common.util.internal.DBInfoBasic

setEnvProperties

public void setEnvProperties(java.util.Hashtable<java.lang.String,java.lang.String> env)
Sets environment properties for initial context

Overrides:
setEnvProperties in class quadbase.common.util.internal.DBInfoBasic

getDatabaseConnection

public static java.sql.Connection getDatabaseConnection(java.lang.String driverName,
                                                        java.lang.String urlString,
                                                        java.lang.String userName,
                                                        java.lang.String passwd)
This static function establishes a connection to the specified database and returns a connection object to it.

Parameters:
driver - The driver name
url - The url to the database
username - The username used to connect to the database
password - The database password
Returns:
connection The connection object

getDatabaseConnection

public static java.sql.Connection getDatabaseConnection(java.lang.String JNDIName,
                                                        java.util.Hashtable<java.lang.String,java.lang.String> env)
                                                 throws java.sql.SQLException
This static function establishes a connection to the specified database and returns a connection object to it.

Parameters:
JNDIName - JNDI lookup name for the database
env - Environment properties for initial context
Returns:
connection The connection object
Throws:
java.sql.SQLException

setConnection

public void setConnection(java.sql.Connection conn)
This function sets the connection field in this object.

Overrides:
setConnection in class quadbase.common.util.internal.DBInfoBasic
Parameters:
connection - A reference to the Connection object.

establishConnection

public boolean establishConnection()
internal use only This function establishes a connection to the database specified by the url string

Overrides:
establishConnection in class quadbase.common.util.internal.DBInfoBasic
Returns:
true is connection is established, false otherwise

closeConnection

public void closeConnection()
internal use only This function closes the connection to the database

Overrides:
closeConnection in class quadbase.common.util.internal.DBInfoBasic

fetchData

public DbData fetchData()
                 throws java.sql.SQLException
Get the data from database, return as instance of DbData ClassNotFoundException is thrown if JDBC driver not found. If there is error in SQL execution an SQLException will throw.

Throws:
java.sql.SQLException

getColData

public static quadbase.reportdesigner.report.ColData[] getColData(quadbase.common.util.IDatabaseInfo dbInfo,
                                                                  boolean isSpreadSheet,
                                                                  boolean[] transposeCol,
                                                                  int startIndex,
                                                                  int displayRow)
                                                           throws java.lang.Exception
Retrieves data in column form using the database information provided.

Parameters:
dbInfo - database connection information
isSpreadSheet - states whether this column data is a spread sheet
transposeCol - transpose column mapping
startIndex - starting row to retrieve data
displayRow - number of rows to retrieve (-1 retrieves all data)
Throws:
java.lang.Exception

getColData

public static quadbase.reportdesigner.report.ColData[] getColData(quadbase.common.util.IDatabaseInfo dbInfo,
                                                                  boolean isSpreadSheet,
                                                                  boolean[] transposeCol,
                                                                  int startIndex,
                                                                  int displayRow,
                                                                  boolean optimizeMemory)
                                                           throws java.lang.Exception
Retrieves data in column form using the database information provided.

Parameters:
dbInfo - database connection information
isSpreadSheet - states whether this column data is a spread sheet
transposeCol - transpose column mapping
startIndex - starting row to retrieve data
displayRow - number of rows to retrieve (-1 retrieves all data)
optimizeMemory - whether to optimize memory
Throws:
java.lang.Exception

EspressReport 6.6