JobDataOdbc class

Package: com.tecit.TFORMer.Printing

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

Usage and notes

Overview

An ODBC query supplies records from database tables for generating output. Use JobDataOdbc to supply the query results as the JobData of 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 identifies an ODBC data source configured on the system. On Windows, configure it using the ODBC Data Source Administrator. Include DSN=... in the connection string, as shown below.

This may yield the following code:

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

Example

This example assumes an ODBC data source named TFORMer_Sample with the table tbl_Example shown below.

ChapterNumber

Caption

PageNumber

1

Content

2

1.1

Table of Figures

6

1.2

List of Tables

6

2

Disclaimer

7

...

...

...

The following example uses this table to generate PDF output.

  // 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/9/Examples
  // - Older Microsoft Windows versions: C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/9/Examples
  printJob.setRepositoryName("C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/9/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.

Base types: JobData

Inherited members (4)

Constructors

MemberDescription
JobDataOdbc()

Constructor for JobDataOdbc.

JobDataOdbc(String, String, String, String)

Constructor for JobDataOdbc.

Methods

MemberDescription
getDsn()Returns: String

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

getPassword()Returns: String

Gets the password for the database connection.

getRecordCopyDataField()Returns: String

Gets the name of the DataField which specifies the number of Record copies.

getSqlSelect()Returns: String

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

getUser()Returns: String

Get the user-name for the database connection.

setDsn(String)Returns: void

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

setPassword(String)Returns: void

Sets the password for the database connection.

setRecordCopyDataField(String)Returns: void

Sets the name of the DataField which specifies the number of record copies.

setSqlSelect(String)Returns: void

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

setUser(String)Returns: void

Sets the user-name for the database connection.

Search documentation

Search in
More scopes
Additional scopes

All contents