Net.Data JavaBeans

Net.Data provides JavaBeans that can be used in a Java environment without having a Web server running. A JavaBean is an object-oriented programming interface that lets you build reusable applications or program building blocks. These objects can be used in a network on Java-enabled operating system.

Using a native Net.Data DLL, the JavaBean invokes Net.Data, populating the return code and a string containing the Net.Data output (results). Because JavaBeans use a native DLL, you do not have to have a Web server running to use Net.Data functions.

Design tip: The results returned by the Net.Data JavaBeans are whatever your macro or function returns; in general, this is HTML. Consider passing the results to an HTML-like JavaBean which understands HTML and displays the results.

With JavaBeans you can:

This section describes the following JavaBean topics:

About Net.Data JavaBeans

Net.Data provides JavaBeans to help you develop and manage macros using the Java environment. JavaBeans are Java objects that provide the following interface:

Net.Data provides two types of JavaBeans:

Net.Data Macro JavaBean
Provides a Java-based interface for executing an existing Net.Data macro through Net.Data.

Net.Data SQL JavaBean
Provides a Java based interface for executing an SQL statement through Net.Data.

The Net.Data JavaBeans are Java-based wrappers that run through Net.Data using a native DLL file. Both require Net.Data Version 2 or higher and JDK Version 1.1 or higher to be installed.

Setting Up and Running the Net.Data JavaBeans

This section describes how to set up and run Net.Data JavaBeans using a JavaBean development tool, such as Bean Machine. Steps for using development tools are generic so that you can use the tool of your choice.

The Macro Bean

The Net.Data Macro bean, com.ibm.netdata.beans.NetDataMacro, lets you use Java to run an existing macro. To use this bean, you need to specify Net.Data properties for the bean so that it can work with the macro.

To set up the Net.Data macro JavaBean with a JavaBean development tool:

  1. Add or import the <inst_dir>/beans/NetDataBeans.jar file into your JavaBean development tool.
  2. Using the development tool's customizer interface, set the following input properties:

    Macro
    Specifies the name of the existing macro to execute. For example: MyMacro.mac

    Block
    Specifies the name of the HTML block section to execute; the default is report.

    HTML path
    Specifies the path to the Net.Data db2www.ini file.

    Parameters
    Specifies the parameter name and values to use when running macro.

    Syntax:

    name1=value1&nameN=valueN
    

To run the Net.Data macro JavaBean with a JavaBean development tool:

  1. Select the run or execute action provided by your JavaBean development tool to run the macro.
  2. After the macro has run, you can reference the following output properties:

    RC
    Specifies the return code returned from Net.Data.

    Results
    Specifies the data returned from the execution of the Net.Data macro.

The SQL Bean

The Net.Data SQL bean, com.ibm.netdata.beans.NetDataSQL, lets you use Java to run an SQL statement through Net.Data. To use this bean, you need to specify Net.Data properties for the bean so that it can work with the macro.

To set up the Net.Data SQL JavaBean with a JavaBean development tool:

  1. Add or import the NetDataBeans.jar file into your JavaBean development tool.
  2. Using the development tool's customizer interface, set the following input properties:

    Language environment
    Specifies the language environment to use; the default is DTW_SQL.

    SQL
    Specifies the SQL statement to run; the default is select * from employee.

    DATABASE
    Specifies the database to use; the default is SAMPLE.

    HTML path
    Specifies the path to the Net.Data db2www.ini file.

    Parameters
    Specifies the parameter name and values to use when running the SQL statement.

    Syntax:

    name1=value1&nameN=valueN
    

To run the Net.Data SQL JavaBean with a JavaBean development tool:

  1. Select the run or execute action provided by your JavaBean development tool to run the macro.
  2. After the SQL statement has run, you can reference the following output properties:

    RC
    Specifies the return code returned from Net.Data.

    Results
    Specifies the data returned from the SQL statement.


[ Top of Page | Previous Page | Next Page | Index ]