IBM Support

DRAFT - Configuring Eclipse to work with the Netezza plug-in

Question & Answer


Question

How do I configure Eclipse and start work with the Netezza plug-in?

Answer

To start using the Netezza Eclipse plug-in, you need Eclipse IDE, which can be downloaded from http://www.eclipse.org/downloads/ and unpacked in a local directory. IBM recommends C/C++ Developers Eclipse CDT.

For more detailed information on the Netezza Eclipse plug-in, refer to the Netezza Developer Network

NOTE for Mac OS X users: The Netezza Eclipse plug-in requires that you have Java Runtime Environment (JRE) 1.6 installed. By default, Mac OS uses Java 1.5. If you do not already have it, install Java 1.6 before installing the Netezza Eclipse plug-in. If you would like to keep both Java 1.5 and 1.6, run Eclipse with the following option:

./eclipse -vm path_to_java_1.6_executable


Download the Netezza Eclipse Plug-in

There are two versions of the Netezza Eclipse plug-in code available--a stable version and an alpha version. It is recommended that you use the stable version, however an alpha version is available for users who wish to test the latest version of the plug-in. Additionally, the alpha version (1.2.5.4) of the Netezza Eclipse Plug-in provides support for NZ Cartridge Manager (nzcm).

To download the plug-in, follow the instructions below:

1. Launch the eclipse program.

2. From the menu, select Help and then Install New Software…

3. Click the Add button.

4. Enter the site URL for the appropriate code. Refer to the following table for links to the update sites. Note that this information is correct as of July 9, 2010.



5. Press the OK button. The Install plugin screen appears.

6. Choose NZUpdateSite and then select NZ Environment.




7. Select Next and Finish to start (and complete) the installation.

Using the Netezza Eclipse Plug-in

1. From the directory where you installed\unpacked Eclipse, run nzeclipse\eclipse.exe.

2. In the top right corner of the Eclipse window, select the Open perspective button and then NZ Development.



The Netezza Eclipse plug-in is now ready for use. You can change the layout of your project at any time, according to your needs.



Understanding Netezza Project Structure

Netezza projects can be organized in a variety of ways. However, particular conventions are encouraged to make it easy to identify typical parts of the project. The main goal of the project structure is to define the standards to follow during the development process. These include code standards, documentation standards, and change control procedure standards.

NZ Project

Typically, NZ Project is represented by a folder under the workspace. By default, the contents of a project has the following structure:




This section describes in detail the typical project structure.

build

The build directory contains the binaries like object files, documentation, and cartridges.

data

The data folder contains any data files used for demonstration purposes. It is important to specify appropriate targets in the makefile located in the data directory.

Currently, the Netezza Eclipse plug-in manages three target types for data:

  • NZSQL--These are SQL scripts that create tables, etc. The name of the target should correspond with the SQL file name (makefile is looking for the filetarget_name.sql).
  • R--R scripts are responsible for data file creation. The name of the target should correspond with the SQL file name (makefile is looking for the file target_name.R)
  • NZLOAD--These are the data files that should be loaded into tables (csv, dat, etc.). The name of the target should correspond with the SQL file name (makefile is looking for the file target_name.extension)

Below is a sample of a typical makefile:
include footer.mk

T := target-create # first target (table creation)
TARGETS += $T
$T_SQLARGS := # nzsql options
$T_TYPE := NZSQL # target type

T := target-prepare # second target (data preparing)
TARGETS += $T
$T_TYPE := r # target type
$T_RARGS := -q --vanilla # R options

T := target # second target (data loading)
TARGETS += $T
$T_TYPE := nzload # target type
10
NZeclipse - Netezza Eclipse Developer's Guide
$T_SQLARGS := -delim ',' # nzload options
$T_TABLE := table # where to load
$T_EXT := csv # file extension


docs

The docs folder is a project documentation directory.

example

The example directory contains any examples or demos. It should contain the readme file with the description of how to set-up and run the demo and examples.

src

The src directory is where all sources are kept. The src directory contains the project modules.

A project is divided into modules. A module should be an independent part of a project that represents logical functionality. Each module contains source files and themakefile with the target specifications. Currently, Netezza Eclipse manages two types of targets for the module:

  • SQL--These are SQL scripts with procedures. Each SQL target has three associated files:
  • target_name.sql, the main source file
  • target_name_help.sql, the help file (which is automatically generated during the build process)
  • target_name_comment.sql, the comment file (which is also automatically generated during the build process)
  • UDX--The CPP file with UDX sources (makefile is looking for the file target_name.cpp)

Below is an example of a typical makefile for a module:

include header.mk

###################################
T := _cf_utl_getParam_str #target name
$T_TYPES := udx #target types (space separated)
$T_SOURCES := $T.cpp #source files
$T_SIG := _cf_utl_getParam_str(varchar(any),varchar(any))
$T_RETURN := VARCHAR(300)
$T_CLASS := C$T
$T_CCARGS := --args '$(MYARGS)' #additional parameters
# Place for --deps --fenced -g --lastcall --mask --nondet --noparallel --nullcall --sputype --varargs --version
$T_REGARGS := --nullcall


###################################
T := _sp_utl_tableExists
$T_TYPES := sp
#Additional parameters to run SQL file
$T_SQLFLAGS := -q

###################################
T := mpi_ae_pingpong_play
$(T)_TYPES := ae
$(T)_SIG := $(T)(VARCHAR(1000))
$(T)_RETURN := TABLE (msg VARCHAR(1000))
$(T)_REGARGS := \
      --unfenced

###################################
T := NzaeComm
$(T)_TYPES := so
$(T)_SOURCES := $T.cpp
$(T)_CCARGS := -Wall
$T_INSTALL_HEADERS := $(T).h
$(T)_REGARGS := DEPENDENCIES libnzaechild

include footer.mk

The src directory has a special uninstall subfolder. This folder contains a SQL script, drop_contents.sql, for SQL statements that drop contents from a database (UDX, tables, stored procedures, etc.).

Main Directory

In the main project directory there is a set of files where users should put appropriate information about:

  • BUILD_NUM: the actual build number (this information could also be provided as a makefile variable, e.g., make BUILD_NUM=1023).
  • DATABASE: the name of the default database used to register all objects.
  • DBOBJECTS: a list of database objects installed by the package. Objects include UDFs, UDAs, stored procedures, libraries, tables, and views. Enter one object per line in the form type:name, where type is one of the following: FUNCTION, AGGREGATE, PROCEDURE, LIBRARY, TABLE, or VIEW. This file can be used for searching via nzcm.
  • DEPENDENCIES: contains a list of dependencies. There are two types of dependencies--cartridge dependencies and external dependencies. An external dependency should be a script that returns the 0 exit status if the dependency is met and 1 otherwise. A cartridge dependency may be specified by adding an entry with a name of a cartridge, or a name and a version, or a name and a version to be greater than, or a name and a version range. A dependency line should be of the form type:depedency where type is either EXTERNAL or CARTRIDGE. If it is EXTERNAL, then the rest of the line is a script with optional arguments. If it is CARTRIDGE, the rest of the line is the name and version information. This can be of the following form:
* CARTRIDGE: bar (Any version of bar)
* CARTRIDGE: bar = 1.0.0 (bar in version 1.0.0)
* CARTRIDGE: bar >= 1.0.0 (bar in version 1.0.0 or greater)
* CARTRIDGE: bar <= 2.0.0 (bar in version 2.0.0 or lower)
* etc.
  • LICENSE: contains the license file.
  • PRODUCT: contains the name of the product (without the version). If the PRODUCT_DIR file does not exist, this value will be used for directory creation.
  • PRODUCT_DIR: contains the desired directory name to be used for the product, if it exists.
  • README: contains the readme file.
  • VENDOR: contains the name of the vendor. If the VENDOR_DIR file does not exist, this value will be used for directory creation.
  • VENDOR_DIR: contains the desired directory name to be used for the vendor, if it exists.
  • PRODUCT VERSION: contains the product version number.

The main makefile is the place where users can define modules to compile. Advanced programmers can also add custom targets.
[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":null,"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

NZ408571

Document Information

More support for:
IBM PureData System

Software version:
1.0.0

Document number:
197221

Modified date:
17 October 2019

UID

swg21577828