TFORMer SDK - JAVA  7.0
Public Member Functions
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

 JobDataOdbc ()
 Constructor for JobDataOdbc.
 JobDataOdbc (String sDsn, String sUser, String sPassword, String sSqlSelect)
 Constructor for JobDataOdbc.
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.
boolean isHandleEscapeSequences ()
 Gets/Sets a flag indicating whether escape sequences in DataField values like \n or \x40 should be translated by TFORMer SDK.
boolean isReuseValues ()
 Gets a flag indicating whether DataField-values should be reused in consecutive records.
void setDsn (String sDsn)
 Sets the DSN (ODBC data-source-name).
void setHandleEscapeSequences (boolean bHandleEscapeSequences)
 Sets a flag indicating whether escape sequences like \n or \x40 should be translated by TFORMer.
void setPassword (String sPassword)
 Sets the password for the database connection.
void setReuseValues (boolean bReuseValues)
 Sets a flag indicating whether DataField values should be reused in consecutive Records.
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).

Overview

The JobDataOdbc enables TFORMer SDK to use arbitrary database-tables or queries as JobData for printing a Job.The data in such a table provides the values of the DataFields. The table is read Record by Record using the specified SQL SELECT statement. TFORMer SDK matches the column-names of the table or query with the corresponding DataField names 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.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:

  // Set the DSN programmatically
  jobDataOdbc.setDsn("DSN=TFORMer_Sample");

Example

This example demonstrates how to use the pre-installed ODBC data-source (named TFORMer_Sample) for generating a report as PDF. The table tbl_Example looks like follows:
ChapterNumber Caption PageNumber
1 Content 2
1.1 Table of Figures 6
1.2 List of Tables 6
2 Disclaimer 7
... ... ...
This is the code to use this table as a JobDataOdbc:
  // Create a new Job instance
  Job printJob = new Job();
  
  // Select the stand-alone FormLayout named ODBCReportPDF.tff
  // This FormLayout is usually installed as part of the TFORMer Examples in
  // - Windows Vista or later: C:/Program Data/TEC-IT/TFORMer/7.0/Examples
  // - Older Microsoft Windows versions: C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/7.0/Examples  
  printJob.setRepositoryName("C:\\Documents and Settings\\All Users\\Application Data\\TEC-IT\\TFORMer\\7.0\\Examples\\Command Line\\ODBCReportPDF\\ODBCReportPDF.tff");

  // Create a new JobData instance using the installed sample ODBC connection named TFORMer_Sample
  JobData jobData = new JobDataOdbc("DSN=TFORMer_Sample", "", "", "SELECT  FROM tbl_Example");

  // Assign the JobData to the Job
  printJob.setJobData(jobData);

  // Select PDF output to /temp/out.pdf 
  printJob.setOutputName  ("/temp/out.pdf");
  printJob.setPrinterType (EPrinterType.PDFFile);

  // Generate output based on the FormLayout and the JobData
  printJob.print ();

More Information

For a general description see JobData.

See also:
JobData
Note:
Thread-safety: A single instance of this class must not be used by different threads.

Constructor & Destructor Documentation

Constructor for JobDataOdbc.

Initializes a new instance of the JobDataOdbc class.

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

Constructor for JobDataOdbc.

Initializes a new instance of the JobDataOdbc class.

Parameters:
sDsnThe DSN (ODBC data-source name)
sUserThe (optional, may be empty) user name as required by the ODBC connection
sPasswordThe (optional, may be empty) password as required by the ODBC connection
sSqlSelectThe SQL-SELECT 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)
boolean isHandleEscapeSequences ( ) [inherited]

Gets/Sets a flag indicating whether escape sequences in DataField values like \n or \x40 should be translated by TFORMer SDK.

Returns:
true if escape sequences in DataField values are translated
See also:
JobData, Escape Sequences
boolean isReuseValues ( ) [inherited]

Gets a flag indicating whether DataField-values should be reused in consecutive records.

Returns:
false if DataField-values are cleared between records
See also:
JobData
void setDsn ( String  sDsn)

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

Parameters:
sDsnThe DSN
See also:
JobDataOdbc
void setHandleEscapeSequences ( boolean  bHandleEscapeSequences) [inherited]

Sets a flag indicating whether escape sequences like \n or \x40 should be translated by TFORMer.

Parameters:
bHandleEscapeSequencestrue if escape sequences in DataField-values should be translated
See also:
JobData, Escape Sequences
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:
sPasswordThe password for the DSN (optional)
void setReuseValues ( boolean  bReuseValues) [inherited]

Sets a flag indicating whether DataField values should be reused in consecutive Records.

Parameters:
bReuseValuesfalse if DataField-values should be cleared between Records
See also:
JobData, DataField
void setSqlSelect ( String  sSqlSelect)

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

Parameters:
sSqlSelectThe 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:
sUserThe user-name for the DSN (optional)

© 2006-2012 - all rights reserved by TEC-IT Datenverarbeitung GmbH
Generated on Tue Oct 23 2012 16:33:20 for TFORMer SDK - JAVA with doxygen 1.8.0