At this point you should already be familiar with Eclipse. But if you are not, Eclipse is the de facto integrated development environment (IDE) for developing Java applications. It provides comprehensive support for Java technologies, as well as a platform for plug-in tools to extend its capabilities. Teradata Plug-in for Eclipse extends the Eclipse IDE with plug-ins that support Teradata application developers. It provides dialogs and wizards to ease the techincal and operational challenges when creating database objects, such as databases (or schemas), tables, stored procedures, user-defined functions, etc. Teradata Plug-in for Eclipse is targeted at improving the productivity of Java oriented developers by bringing more of their activities into a single Eclipse based IDE.
The computer where the Teradata Plug-in for Eclipse will be installed must be running one of the following operating systems:
|Windows XP Professional|
|Windows Server 2003|
Before we can start using the Teradata Plug-in, we need to create our Eclipse DTP environment. The first step is to download the required software: Java Runtime Environment (JRE), Eclipse and DTP software, and Teradata JDBC Driver.
The following packages need to be installed:
Teradata Plug-in for Eclipse supports Eclipse versions 3.4.1
As an option to downloading the individual Eclipse packages, Eclipse has bundled the above packages (Eclipse SDK, EMF, SDO, GEF, and DTP) into a single download, Eclipse IDE for Java EE Developers. This package also includes additional Eclipse packages for Web application development. It should also be noted that the bundled package does not include the XSD package that is used when creating and viewing XML Schema Definition files.
Simply unzip the zip files or, in the case of the JRE, run the execution file. For the Eclipse install, unzip the download files into your Eclipse directory.
Next, bring up Eclipse by double clicking on eclipse/eclipse.exe. Eclipse will prompt you for a Workspace folder that it uses to maintain the metatdata for your Eclipse session. You can browse your directory for an existing workspace folder or enter the name for your new workspace. It is recommended that you enter a name relavent to your developement, for example 'JXSP_workspace' for your Java external stored procedure development.
Next a Welcome screen will appear. Click the ‘X’ at the top left hand corner to close the 'Welcome' tab.
Install Teradata Plug-in from the Teradata Datatools Update Site. Within Eclise, go to the Help menu and click the Software Updates... option. Choose the Available Software tab and click the Add Site... button.
In the Add Site pop up window, enter the Teradata Update Site URL in the Location (www.teradata.com/datatools/update). Click OK. You should notice that Teradata Plug-in for Eclipse is added to your Available Software list.
Select Teradata Plug-in for Eclipse and click the Install... button on the right hand side. If the update site is not in the list, click the Manage Sites...button. You should find the site in the list and check the box. Click OK. It should now show up in the Available Software list. After the install, Eclipse will prompt you to restart Eclipse. Click Yes.
The next task is to create a connection profile for your Teradata Database. Make sure that the Eclipse Data Source Explorer View is opened. Eclipse Views provide an alternative presentation of the data, as well as an additional way to navigate information in the Eclipse workbench. The Data Source Explorer View provides a tree view of the database objects and tools for running routines and viewing results.
To open the Data Source Explorer View, click the Window>Show View>Other option in the top-level menu. Double click on the Connectivity>Data Source Explorer item. You will notice the Data Source Explorer (DSE) tab in the workspace. Drag the tab over to the left hand pane for more space to browse the databases and their associated database objects, such as tables, columns, stored procedures, macros, user-defined functions, user-defined types, and views.
To create a Teradata connection profile, right click on the Databases folder in the Data Source Explorer and select the New… option. The New Connection Profile wizard will display the list of Connection Profile Types. Choose the Teradata Database type and enter a name for your profile. Click Next and select a driver. A Teradata JDBC Driver template has been provided. The first time you come into the New Connection Profile wizard, the Teradata JDBC Driver will not show up in the drop-down list. The user needs to click on the asterisk,, to the right of the drop-down and the Teradata JDBC Driver will appear in the ‘New Driver Definition’ screen. Select the Teradata JDBC Driver and click OK. If the OK button is not enabled, check to see if there is an error displayed at the top of the dialog. It could be that the Teradata JDBC JARs have been installed in a different location than what is expected in the template.
To modify the list of jars or list of database properties that will be used with this driver, click on the Jar List or Properties tab. NOTE: The Jar List assumes the Terdata JDBC Driver JARs have been installed in the C:\TeraJDBC directory. If you have installed them in a different location, you must modify the Jar List.
Click OK to return the the New Teradata Connection Profile screen.
Next, enter the Database Server Name, User Name, Password and Database values. You can also add or modify properties for your connection in the Optional properties box. Enter the attribute/value pair and click the Add button. Or to remove an attribute, select it from the list and click the Remove button.
Optionally, you can click the Test Connection button to verify that your connection profile definition is correct. Click Finish to return to the DSE and create the connection.
You now have a Teradata Database connection profile that you can use to browse the schemas and their database objects or invoke the ‘Create’ dialogs to create new database objects, such as Users, Schemas (or Databases), Tables, Macros, Views, or Stored Procedures. By right clicking an entry in the Data Source Explorer tree, the Teradata menu option will appear. Open this option to find the appropriate ‘Create’ dialogs.
Another option for browsing information about the Teradata Database objects is the ‘Show in Teradata View’ option. This option will open a Teradata View tab and display more detailed information for objects that are selected in the Data Source Explorer. In the example below, the ‘ide’ schema has been selected in the DSE and the ‘Show in Teradata View’ option was selected. Within the Teradata View tab, an Overview, Tables, Views, Macros, Procedures, JXSP Jars, UDFs, and UDTs tabs are displayed.
Once the ‘Show in Teradata View’ option is selected, subsequent selections from the DSE will continue to be shown in the Teradata View. To close the Teradata View, click the ‘X’ on the Teradata tab.
If you are creating a Java stored procedure, make sure that you have selected a system that has Teradata Database version 12.0 or greater. If you are creating a Java user-defined function, make sure that you have selected a system that has Teradata Database version 13.0 or greater. Along with the correct version of Teradata, you must also have the SQLJ feature installed. SQLJ can only be installed on 64-bit server machines. For smaller, laptop configurations, Teradata Express Edition also supports SQLJ features. Teradata Express can be found on the Teradata Download Center.
SQLJ contains stored procedures and views used to manage the JARs used by Java stored procedures and Java user-defined functions. A JAR or Java Archive is used for aggregating many Java class files into one. It is used to deploy the Java classes on the Teradata Database. If you click on the SQLJ schema and open the Stored Procedures folder, you should see several stored procedures, such as install_jar, replace_jar, remove_jar, and alter_java_path. You must also have ‘Execute Procedure’ permissions granted on the SQLJ database.
SQLJ is installed by running the SQLJ Database Initialization Program (DIP) script called DIPSQLJ. DIP is a series of executable script files packaged with Teradata Database. Refer to the Teradata Utilities documentation for more detailed information on running DIP.
If you are using Java Runtime Environment version 1.6 (jre6), your compiler must have the compliance level set to 1.5 when creating Java stored procedures or Java user-defined functions on Teradata. The reason for this is that the JRE version used by Teradata is 1.5 and classes compiled with JRE 1.6 are not compatible. In order to set the compliance level, select the Window>Preferences option from the top-level menu. This will bring up the Preferences popup dialog. Open the Java>Compiler preference and change the 'Compiler compliance level' to '1.5' from the drop down list. Click the Apply, then OK button to close the preferences dialog.
You are now ready to browse your Teradata database systems or create new database objects. The Teradata Plug-in for Eclipse provides the following easy to use functions:
Each of these functions simplifies the effort required to develop active applications using Java and Eclipse.