JobDataOdbc Class Reference

Provides access to JobDataOdbc (an ODBC connection that serves as JobData for a Job). More...

List of all members.

Public Member Functions

String getDsn ()
 Gets the DSN (ODBC data-source-name).
String getPassword ()
 Gets the password for the database connection.
String getSqlSelect ()
 Gets the SQL select statement for fetching the records from the database.
String getUser ()
 Get the user-name for the database connection.
 JobDataOdbc (String sDsn, String sUser, String sPassword, String sSqlSelect)
 Initializes a new instance of the JobDataOdbc class.
 JobDataOdbc ()
 Initializes a new instance of the JobDataOdbc class.
void setDsn (String sDsn)
 Sets the DSN (ODBC data-source-name).
void setPassword (String sPassword)
 Sets the password for the database connection.
void setSqlSelect (String sSqlSelect)
 Sets the SQL select statement for fetching the records from the database.
void setUser (String sUser)
 Sets the user-name for the database connection.


Detailed Description

Provides access to JobDataOdbc (an ODBC connection that serves as JobData for a Job).




The JobDataOdbc enables TFORMer Runtime to use arbitrary database-tables or queries as JobData for printing a Job.
The data in such a table provides the values of the data-fields. The table is read Record by Record using the specified SQL statement SqlSelect.
TFORMer Runtime must be able to match the column-names of the table with the corresponding DataField-names as used in the FormLayout. If required use SQL aliases to provide identical column names.

The order of the columns in the table or query does not matter.

Examples



This example demonstrates how to use the preinstalled ODBC data-source (named TFORMer_Sample) for generating a report as PDF. The table tbl_Example looks like follows:
This is the code to use this table as a JobDataOdbc:

 // create a Job instance Job. 
 job = new Job();
 
 // select the stand-alone form-layout named ODBCReportPDF.tff. This form-layout is usually installed as part of the TFORMer Examples 
 job.setRepositoryName("C:\\Program Files\\TEC-IT\\TFORMer\\5.0\\Examples\\Command Line\\ODBCReportPDF\\ODBCReportPDF.tff");
 
 // create an ODBC data-source using the installed sample ODBC connection named TFORMer_Sample JobDataOdbc jobData =
 JobData jobData = new JobDataOdbc("DSN=TFORMer_Sample", "", "", "SELECT * FROM tbl_Example");
 
 // assign the Data-Source to the Job. 
 job.setJobData(jobData);
 
 // A PDF-document named C:/temp/out.pdf should be generated. 
 job.setOutputName("C:/temp/out.pdf");
 job.setPrinterType(EPrinterType.PDFFile); 


For a general description see JobData.

Constructor & Destructor Documentation

JobDataOdbc ( String  sDsn,
String  sUser,
String  sPassword,
String  sSqlSelect 
)

Initializes a new instance of the JobDataOdbc class.

Parameters:
sDsn The Dsn (ODBC data-source name).
sUser The User-name as required by the ODBC connection. May be empty.
sPassword The Password as required by the ODBC connection. May be empty.
sSqlSelect The SqlSelect statement.


Member Function Documentation

String getDsn (  ) 

Gets the DSN (ODBC data-source-name).

Returns:
The DSN.

String getPassword (  ) 

Gets the password for the database connection.

Returns:
The password for the DSN (optional).

String getSqlSelect (  ) 

Gets the SQL select statement for fetching the records from the database.

Returns:
The SQL select statement (required).

String getUser (  ) 

Get the user-name for the database connection.

Returns:
The user-name for the DSN (optional).

void setDsn ( String  sDsn  ) 

Sets the DSN (ODBC data-source-name).

The DSN represents the name of the database connection as defined in the Microsoft Windows Control Panel. Please keep in mind that the DSN is a part of the connection string and thus a complete specification is required. This may yield the following code:
jobDataODBC.setDsn("DSN=TFORMer_Sample");

Parameters:
sDsn The DSN.

void setPassword ( String  sPassword  ) 

Sets the password for the database connection.



It depends on the database connection if the password is required or not.

Parameters:
sPassword The password for the DSN (optional).

void setSqlSelect ( String  sSqlSelect  ) 

Sets the SQL select statement for fetching the records from the database.

Parameters:
sSqlSelect The SQL select statement (required).

void setUser ( String  sUser  ) 

Sets the user-name for the database connection.



It depends on the database connection if the user-name is required or not.

Parameters:
sUser The user-name for the DSN (optional).


© 2006-2009 All rights reserved by TEC-IT Datenverarbeitung GmbH
Generated on Wed Sep 2 16:01:27 2009 for TFORMer Runtime JAVA Developer Reference with doxygen 1.5.8