
UDS API interface
To use the UDS API, the interface jet.datasource.JRUserDataSource must be implemented, and the class definition may be as follows:
import jet.datasource.*;
public class UserUDS
implements JRUserDataSource
{
// Class body.
}
|
Reference: JReport Designer Javadoc jet.datasource.JRUserDataSource class in <install_root>\help\designer\api.
The following are methods of the interface:
Public java.sql.ResultSet getResultSet(String strParam) throws JRUserDataSourceException
This method gets the result set for user data source.
- PARAMETER: strParam - A String value used to request and get different result sets. The format of the PARAMETER string is defined and parsed by yourself. You can enter the PARAMETER string when you add the UDS to a catalog. If you want to use parameters predefined in the Catalog Browser, you can add @paraName into the PARAMETER string.
Keep in mind the parsing rules for the PARAMETER string when you enter the PARAMETER string.
- The characters used for parameter name can be any character defined on the key board, except for quotation marks.
- Parameter name is introduced with @, and sometimes colon : is also recognized as an introducer.
- When your PARAMETER string contains characters such as @, "", : or other strings which do not need to be parsed by JReport, you should then quote the whole string with quotation marks, so that they are not parsed as the beginning mark of the parameter name. For example,
jdbc:oracle:thin:@204.177.148.30:1521:orcl. Here, '@' is a character used by the URL. If you add this PARAMETER string, '204' will be considered as the name of a parameter in a catalog. Thus, the correct form is: jdbc:oracle:thin:"@"204.177.148.30:1521:orcl.
- Returns: java.sql.ResultSet - A row and column dataset that can be used in JReport.
- Throws: JRUserDataSourceException - If a database access error occurs.
When you provide a java.sql.ResultSe instance, to reduce your work, you do not need to implement all methods of java.sql.ResultSet. You can just extend abstract class jet.datasource.JRResultSet. If you specify the column properties, for example, SQL data type, and precision, you will not need to provide a ResultSetMetaData instance, and JReport will not invoke getMetaData() function of ResultSet. However, if you do not specify the properties, you will have to implement the getMetaData() function and provide a ResultSetMetaData instance.
Public void releaseResultSet() throws JRUserDataSourceException
This method frees the ResultSet object.
- Throws: JRUserDataSourceException - If there are some errors when freeing the resource.
