public class DBInfo extends quadbase.common.util.internal.DBInfoBasic implements IDatabaseInfo
This class provides an implementation for the quadbase.reportdesigner.util.IDatabaseInfo interface. It stores information necessary to retrieve data from a database.
IDatabaseInfo
Constructor and Description |
---|
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(java.sql.Connection conn,
java.lang.String query,
quadbase.common.paramquery.QueryInParamSet inSet)
Create a new instance of DBInfo using the given Connection object
|
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
|
Modifier and Type | Method and Description |
---|---|
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
|
quadbase.common.paramquery.QueryInParamSet |
getInSet()
Gets the query parameter set
|
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 |
setInSet(quadbase.common.paramquery.QueryInParamSet inSet)
Sets the query parameter set
|
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
|
clone, equals, equals, equalsIgnoreQuery, getAdditionalDb, getContextFactory, getProviderURL, getTableNameFormat, isCloseConnectionEnabled, openConnection, read, readXML, setAdditionalDb, setTableNameFormat, toString, write, writeXML
@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)
url
- URL of database in form of jdbc:databaseName://machineName(or
IPaddress)/schemeNamedriver
- JDBC driver class name useusername
- login user namepassword
- login passwordquery
- SQL query to retrieve data from databaseapplet
- an applet or null if the program is an applicationpublic DBInfo(java.lang.String url, java.lang.String driver, java.lang.String username, java.lang.String password, java.lang.String query)
url
- URL of database in form of jdbc:databaseName://machineName(or
IPaddress)/schemeNamedriver
- JDBC driver class name useusername
- login user namepassword
- login passwordquery
- SQL query to retrieve data from databasepublic 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)
url
- URL of database in form of jdbc:databaseName://machineName(or
IPaddress)/schemeNamedriver
- JDBC driver class name useusername
- login user namepassword
- login passwordquery
- SQL query to retrieve data from databasepublic DBInfo(java.lang.String JNDIName, java.lang.String query, java.util.Hashtable<java.lang.String,java.lang.String> env)
JNDIName
- JNDI lookup name for the data basequery
- SQL query to retrieve data from data baseenv
- Environment properties for the initial contextpublic DBInfo(quadbase.common.util.IDatabaseInfo dbInfo)
dbInfo
- Another DBInfoURL of database in form of@Deprecated public DBInfo(java.sql.Connection conn, java.lang.String query, java.applet.Applet applet)
conn
- a connection to the databasequery
- SQL query to retrieve data from databaseapplet
- the parent appletpublic DBInfo(java.sql.Connection conn, java.lang.String query)
conn
- a connection to the databasequery
- SQL query to retrieve data from databasepublic DBInfo(java.sql.Connection conn, java.lang.String query, quadbase.common.paramquery.QueryInParamSet inSet)
conn
- a connection to the databasequery
- SQL query to retrieve data from databaseinSet
- Parameter set in the querypublic java.lang.String getURLString()
getURLString
in interface quadbase.common.util.IDatabaseInfo
getURLString
in class quadbase.common.util.internal.DBInfoBasic
public java.lang.String getDriverName()
getDriverName
in interface quadbase.common.util.IDatabaseInfo
getDriverName
in class quadbase.common.util.internal.DBInfoBasic
public java.lang.String getUserID()
getUserID
in interface quadbase.common.util.IDatabaseInfo
getUserID
in class quadbase.common.util.internal.DBInfoBasic
public java.lang.String getPassword()
getPassword
in interface quadbase.common.util.IDatabaseInfo
getPassword
in class quadbase.common.util.internal.DBInfoBasic
public java.lang.String getQuery()
getQuery
in interface quadbase.common.util.IDatabaseInfo
getQuery
in interface quadbase.common.util.IJNDIDatabaseInfo
getQuery
in class quadbase.common.util.internal.DBInfoBasic
public java.sql.Connection getConnection()
getConnection
in interface quadbase.common.util.IDatabaseInfo
getConnection
in interface quadbase.common.util.IJNDIDatabaseInfo
getConnection
in class quadbase.common.util.internal.DBInfoBasic
public java.lang.String getJNDIName()
getJNDIName
in interface quadbase.common.util.IJNDIDatabaseInfo
getJNDIName
in class quadbase.common.util.internal.DBInfoBasic
public boolean isUseJNDIDataSource()
isUseJNDIDataSource
in class quadbase.common.util.internal.DBInfoBasic
public java.util.Hashtable<java.lang.String,java.lang.String> getEnvProperties()
getEnvProperties
in interface quadbase.common.util.IJNDIDatabaseInfo
getEnvProperties
in class quadbase.common.util.internal.DBInfoBasic
public void setURLString(java.lang.String url)
setURLString
in class quadbase.common.util.internal.DBInfoBasic
public void setDriverName(java.lang.String driver)
setDriverName
in class quadbase.common.util.internal.DBInfoBasic
public void setUserID(java.lang.String username)
setUserID
in class quadbase.common.util.internal.DBInfoBasic
public void setPassword(java.lang.String password)
setPassword
in class quadbase.common.util.internal.DBInfoBasic
public void setQuery(java.lang.String query)
setQuery
in class quadbase.common.util.internal.DBInfoBasic
public void setJNDIName(java.lang.String name)
setJNDIName
in class quadbase.common.util.internal.DBInfoBasic
public void setUseJNDIDataSource(boolean b)
setUseJNDIDataSource
in class quadbase.common.util.internal.DBInfoBasic
public void setEnvProperties(java.util.Hashtable<java.lang.String,java.lang.String> env)
setEnvProperties
in class quadbase.common.util.internal.DBInfoBasic
public static java.sql.Connection getDatabaseConnection(java.lang.String driverName, java.lang.String urlString, java.lang.String userName, java.lang.String passwd)
driver
- The driver nameurl
- The url to the databaseusername
- The username used to connect to the databasepassword
- The database passwordpublic static java.sql.Connection getDatabaseConnection(java.lang.String JNDIName, java.util.Hashtable<java.lang.String,java.lang.String> env) throws java.sql.SQLException
JNDIName
- JNDI lookup name for the databaseenv
- Environment properties for initial contextjava.sql.SQLException
public void setConnection(java.sql.Connection conn)
setConnection
in class quadbase.common.util.internal.DBInfoBasic
connection
- A reference to the Connection object.public boolean establishConnection()
establishConnection
in class quadbase.common.util.internal.DBInfoBasic
public void closeConnection()
closeConnection
in class quadbase.common.util.internal.DBInfoBasic
public DbData fetchData() throws java.sql.SQLException
java.sql.SQLException
public static quadbase.reportdesigner.report.ColData[] getColData(quadbase.common.util.IDatabaseInfo dbInfo, boolean isSpreadSheet, boolean[] transposeCol, int startIndex, int displayRow) throws java.lang.Exception
dbInfo
- database connection informationisSpreadSheet
- states whether this column data is a spread sheettransposeCol
- transpose column mappingstartIndex
- starting row to retrieve datadisplayRow
- number of rows to retrieve (-1 retrieves all data)java.lang.Exception
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
dbInfo
- database connection informationisSpreadSheet
- states whether this column data is a spread sheettransposeCol
- transpose column mappingstartIndex
- starting row to retrieve datadisplayRow
- number of rows to retrieve (-1 retrieves all data)optimizeMemory
- whether to optimize memoryjava.lang.Exception
public quadbase.common.paramquery.QueryInParamSet getInSet()
public void setInSet(quadbase.common.paramquery.QueryInParamSet inSet)