com.crystaldecisions.reports.sdk
Class DatabaseController

java.lang.Object
  |
  +--com.crystaldecisions.reports.sdk.DatabaseController

public class DatabaseController
extends java.lang.Object

Used to manipulate the Database objects that are contained in a report.


Method Summary
 IDatabase getDatabase()
          Returns the tables and fields available in the report.
 void logon(java.lang.String sUser, java.lang.String sPassword)
           Sets the logon information for each table in the report.
 void setDataSource(IXMLDataSet dataSet, java.lang.String oldTableAlias, java.lang.String newTableName)
           Updates the data source used by the report with the specified IXMLDataSet data set.
 void setDataSource(java.sql.ResultSet data, java.lang.String oldTableAlias, java.lang.String newTableName)
           Updates the data source used by the report with the specified java.sql.ResultSet data set.
 void setTableLocation(ITable curTable, ITable newTable)
          Sets the location of a table to a database that is different from the one originally specified when creating the report.
 void setTableLocationEx(java.lang.Object curTable, java.lang.Object newObject)
          Sets the location of a table to a database, when the report uses a database that is different from the one that was specified when the report was created.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDatabase

public IDatabase getDatabase()

Returns the tables and fields available in the report.

Returns:
An IDatabase object containing the tables and fields available in the report.

setTableLocation

public void setTableLocation(ITable curTable,
                             ITable newTable)
                      throws ReportSDKException

Sets the location of a table to a database that is different from the one originally specified when creating the report. Use this method to change the location of a database table that is active in a report. This is especially useful if a report uses a database that has a different location on your system, or if you have changed the directory or disk location of a database.

Note: This method does not physically move the database. It simply looks for the database table in a location other than the one originally specified when setting up the report.

Parameters:
curTable - The table whose database location you want to change. A table can be obtained by using the getDatabase method in the DatabaseController object or the ReportClientDocument object.
newTable - The new table.
Throws:
ReportSDKException

setTableLocationEx

public void setTableLocationEx(java.lang.Object curTable,
                               java.lang.Object newObject)
                        throws ReportSDKException

Sets the location of a table to a database, when the report uses a database that is different from the one that was specified when the report was created.

The parameters of this method provide greater flexibility than the parameters of the setTableLocation method.

Use the setTableLocationEx method to change the location of a database that is active in a report. This method is especially useful if a report uses a database that has a different location on your system, or if you have changed the directory or disk location of a database.

Note: The setTableLocationEx method does not physically move the database. It simply looks for the database table in a location other than the one that was originally specified when the report was created.

Parameters:
curTable - Represents the table whose database location you want to change. Can be an Integer, an ITable object, or a String specifying the table alias name.
newObject - the new ITable object or IConnectionInfo object
Throws:
ReportSDKException

setDataSource

public void setDataSource(java.sql.ResultSet data,
                          java.lang.String oldTableAlias,
                          java.lang.String newTableName)
                   throws ReportSDKException

Updates the data source used by the report with the specified java.sql.ResultSet data set. This sets a runtime data source for the report. The data that is used is not saved with the report; this means that the next time you open the report, you must reset the data source to see valid data.

Parameters:
data - the java.sql.ResultSet object that will replace the current data source.
oldTableAlias - the alias of the current table. A table's alias can be obtained by using the getDatabase method.
newTableName - the new name of the table.
Throws:
ReportSDKException

setDataSource

public void setDataSource(IXMLDataSet dataSet,
                          java.lang.String oldTableAlias,
                          java.lang.String newTableName)
                   throws ReportSDKException

Updates the data source used by the report with the specified IXMLDataSet data set. This sets a runtime data source for the report. The data that is used is not saved with the report; this means that the next time you open the report, you must reset the data source to see valid data.

Note: The report cannot reconnect to the original data source, since the XMLDataSet object and other objects that are used to construct it only exist at run-time. To reconnect to the original data source, you must create these objects and call setDataSource again.

Parameters:
dataSet - the IXMLDataSet object that will replace the current data source
oldTableAlias - the alias of the current table. A table's alias is obtained with the getDatabase() method in the DatabaseController object, DataDefController object, or ReportClientDocument object. This is an optional parameter that can be an empty string but cannot be null. If it is an empty string, the JRC will look at each table name and attempt to find a matching table in the new dataset as a replacement. If no matching table is found, the original table will be kept.
newTableName - the name of the table from the dataset. This parameter will be ignored if the dataSet parameter is a Crystal Business View object. This is an optional parameter that can be an empty string but cannot be null. If it is an empty string and oldTableAlias is a valid name, the old table name will be used as the new table name. If the oldTableAlias parameter is an empty string, this parameter must also be an empty string.
Throws:
ReportSDKException

logon

public void logon(java.lang.String sUser,
                  java.lang.String sPassword)
           throws ReportSDKException

Sets the logon information for each table in the report. This is a helper function that applies logon information to all of the database connections used in the report; use this method rather than setting the ConnectionInfo for each table.

Note: To have logon applied to reports that use saved data, parameter values for those reports must be set.

Parameters:
sUser - The user name.
sPassword - The password.
Throws:
ReportSDKException