0% found this document useful (0 votes)
263 views9 pages

Teradata Plug-In For Eclipse Frequently Asked Questions: Java Stored Procedures/Java User-Defined Functions

The document provides frequently asked questions and answers about using the Teradata Plug-in for Eclipse. It addresses questions about creating Java stored procedures and user-defined functions, seeing Teradata menu options, exceptions when creating Java objects, updating Java stored procedure classes, debugging Java stored procedures, generating large XSLT files, publishing all rows of XML data, installing XML Services, mapping CLOB columns to XML, and defining data sources for the Teradata JDBC driver.

Uploaded by

Mohan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
263 views9 pages

Teradata Plug-In For Eclipse Frequently Asked Questions: Java Stored Procedures/Java User-Defined Functions

The document provides frequently asked questions and answers about using the Teradata Plug-in for Eclipse. It addresses questions about creating Java stored procedures and user-defined functions, seeing Teradata menu options, exceptions when creating Java objects, updating Java stored procedure classes, debugging Java stored procedures, generating large XSLT files, publishing all rows of XML data, installing XML Services, mapping CLOB columns to XML, and defining data sources for the Teradata JDBC driver.

Uploaded by

Mohan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Teradata Plug-in for Eclipse

Frequently Asked Questions

Java Stored Procedures/Java User-defined Functions


1. I am trying to create a Java Stored Procedure or Java User-defined Function on
my Teradata database but the ‘Create Java Stored Procedure’ or ‘Create Java
User Defined Function’ Wizard is not showing up as a menu option.

Java stored procedures are supported on Teradata version 12.00 or greater. Java user-
defined functions are supported on Teradata version 13.00 or greater. If you have the
correct version of Teradata, verify that you have the SQLJ option configured on your
Teradata database. You should see the SQLJ database, including several stored
procedures, such as install_jar, replace_jar, remove_jar, and alter_java_path. SQLJ is
installed by running the SQLJ dip script, DIPSQLJ. If you are still having trouble,
refer to the Teradata Java Stored Procedure guide for assistance.

2. I am not able to see the ‘Teradata’ menu options. I have installed Eclipse and its
dependencies, EMF, GEF, and DTP, as well as the latest version of Teradata
Plug-in for Eclipse from the Teradata Download site. I can create a connection
profile and connect to my Teradata system but am not able to see the Teradata
menu options. Is there something else I am missing?

Check the database version number that is displayed next to your Database in the
Data Source Explorer (Teradata v. [Link]). If it does not reflect the actual
version from the Teradata database, this may indicate that it is not able to read the
Teradata version correctly. Verify that you have installed the latest version of the
Teradata JDBC Driver (13.0 or later) to resolve this problem.

3. Why am I seeing the following exception when I try to create a Java Stored
Procedure or Java User-defined Function?

[Link]:
[Link].jdbc_4.[Link]: [NCR] [Teradata DBMS]
[TeraJDBC [Link]] Syntax error: Java is not supported on
this system hardware.

Java Stored Procedures and Java User-defined Functions are only supported on 64-bit
systems. If you are running on a laptop and do not need a fully functional Teradata
system, the Teradata Express demo version will support Java Stored Procedures.
Teradata Express can be downloaded from the Teradata Download Center on
[Link].

Page 1 of 9
4. When I renamed my class inside my Java Stored Procedure class file and clicked
Deploy to rebuild my Jar. The Jar file did not contain my Java class file. What
happened?

If you need to rename or move the Stored Procedure class file that you created using
the Java Stored Procedure Wizard, you should follow these steps:
1. Make a copy of the Java Stored Procedure class file. Right click on the class file
and select ‘Copy’. Then right click on the source package and click ‘Paste’. If
renaming the class file, enter the new name of the class file when prompted.
2. Open the Java Stored Procedure Multi-Page Editor by double clicking your .jxsp
file.
3. Select the Class Definition tab and click the Browse button for the Source
Location. Find the Java class file that you just copied and notice that the Source
Location has changed to reflect your newly copied file. The Java class file change
is now updated in the Java Stored Procedure Multi-Page Editor.
4. Delete the old version of your Java class file.

5. I have created a second Java Stored Procedure using the Create Java Stored
Procedure Wizard. In the multi-page editor’s SQL tab, I click the ‘Run SQL’
button but the Java stored procedure is not created and an error message is not
displayed. What went wrong?

Make sure that you have not used a method name that is already used by another Java
Stored Procedure in your schema. A duplicate method or object error will cause the
creation of the Java stored procedure to fail.

6. I am getting the following error when I try to deploy my JAR.

Make sure that your JAR name contains valid characters. Valid characters are:
o Uppercase or lowercase letters (A to Z, a to z)
o Digits (0 through 9)
o The special characters: dollar sign ($), number sign (#), low line (_), dot (.),
and hyphen (-).

Page 2 of 9
Also, the JAR name can not be the word “RETURNS” or contain KANJI characters.

7. How do I display the debug trace information when running my Java Stored
Procedure in Eclipse? I have included calls to [Link](“message”) in
my Java Stored Procedure, performed a SET SESSION FUNCTION TRACE,
called my Java Stored Procedure, but nothing is displayed when I query the
XSP_Trace table.

You must query the XSP_Trace table in the same session as the call to your stored
procedure. One way to do this is using the Eclipse SQL Editor. Create a SQL File that
connects to a Teradata database that contains your Java Stored Procedure and
temporary trace table. Inside the SQL File include the SET SESSION FUNCTION
TRACE statement, CALL <your Java Stored Procedure>, and SELECT from your
XSP_Trace table. Below is an example script:

SET SESSION FUNCTION TRACE USING ‘2’ FOR TABLE ide.XSP_Trace;

CALL [Link](2, ?);

SELECT * from ide.XSP_Trace;

XSP_Trace is the name of the temporary trace table set up for debug.
getCustomerById is the name of the Java Stored Procedure.

Then from the SQL Editor, select the three statements above and right click to get the
SQL Editor menu. Choose the option ‘Execute as Individual Statements’. This will
run each statement and provide the results in the SQL Results tab.

8. I am not seeing my Java Stored Procedure parameters tab in the Multi-page


Editor being updated when I change my Java Source.

Make sure that you have the ‘auto build’ option turned on (√ Build Automatically).
The Java Stored Procedure Multi-page Editor pulls the information from the Java
class file. If ‘auto build’ option is turned off, the Java class is not updated when the
Java source is saved outside of the source window.

To turn on the ‘auto build’ option, right click on the Project option from the top main
menu. Click Build Automatically option. If it is checked, √, then it is on.

XML Services
9. When trying to generate a large XSLT file using the Java Bean Wrapper Wizard
or the Generate XSLT Wizard, I am running out of memory. What can I do to
get around this limitation?

Page 3 of 9
To resolve this issue, increase the amount of memory allocated to Eclipse. This can
be done by modifying the [Link] file, in the /eclipse directory, and increasing the
‘vmargs’ parameters. For example:
-vmargs -Xms1024m-Xmx1024m

10. When running my JavaBean that produces XML result data, I am only seeing
the first row of data, yet when I run the select statement in the Eclipse SQL
Editor, more rows are returned. Why is the SYSXML publishing only returning
one row?

This can occur when the XSLT file does not contain a mapping from an element in
the source to the group level of the target.
Below shows a mapping file that does not map to the group level of the target.

And here is an XSLT file that is mapped to the top level element, Employee

Page 4 of 9
Once the mapping is added to the Employee group, all rows of the result set are
published in the XML result data.

11. I do not see the list of XSLT Stylesheets for my Teradata database. Is something
missing?

Make sure that you have installed the Unicode version of the Teradata XML Services
package. The install package for Teradata XML Services can be found on the
Teradata Download Center.

12. I have Teradata XML Services 1.0 installed but am still not able to generate
XSLT Stylesheets or see the list of XSLT Stylesheets for my Teradata database.
Is something still missing?

Make sure that you have installed the Unicode version. Teradata Plug-in for Eclipse
requires the Unicode version of Teradata XML Services. There is an option on the
install script to install the Unicode version.

13. I am creating an XSLT where my Source XSD contains a CLOB element that is
mapped to an element in the Target XSD. But when I use the XSLT to ‘Publish’
my result data from my JavaBean, an exception is thrown from the database.

Page 5 of 9
There is a known problem in the XML Services with mapping CLOBs. A workaround
for the problem is to ‘cast’ your column as a ‘Varchar’ value in your Select statement.
For example:
SELECT srno, CAST(clobcol as VARCHAR(256)) AS clobcol FROM
[Link];

This Select statement will produce a Source XSD that selects the srno and clobcol
columns from the clobtable table.

NOTE: This may not resolve all problems as the data may be truncated if your CLOB
is larger than 256 bytes. You can increase the size of the Varchar, but there is a limit
of the total row size in Teradata.

JavaBean
14. How do I define a data source in Tomcat to use with the Teradata JDBC driver,
my JavaBean, and Eclipse WTP?

Refer to the Teradata JDBC Driver documentation for configuring the data source file
on Tomcat. Make sure you also copy the data source information to the [Link]
file in the Servers project within your Eclipse workspace, under the Apache Tomcat
‘config’ folder.

Below is a sample [Link] file to define the ‘TeradataDS’ data source resource.
Note that the <serverName>, <userName>, and <password> should be replaced with
the server name, user name, and password for your Teradata server machine.

<!-- The contents of this file will be loaded for each web application -->
<Context>

<!-- Default set of monitored resources -->


<WatchedResource>WEB-INF/[Link]</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<Resource name="jdbc/TeradataDS"
auth="Container"
type="[Link]"
driverClassName="[Link]"
url="jdbc:teradata://<serverName>/CHARSET=UTF8,TMODE=ANSI"
username="<userName>"
password="<password>"
maxActive="8"
maxIdle="8"
maxWait="-1"/>

</Context>

Page 6 of 9
15. I am using my JavaBean that was generated by the Java Bean Wrapper Wizard
with Eclipse WTP Web Services but my web service is not keeping state.

Make sure that you have set the Axis emitter web service preference for “Add scope
to deploy .wdd” to application.

SQL Editor
16. I have a Replace Procedure statement in the SQL Editor that looks valid but the
Teradata Parser is flagging it with an error. How do I see what is expected by
the parser?

You can see the error annotation information by turning on the ‘Show Annotation’
option in the Eclipse Preferences. Right click in the SQL Editor window and select
Preferences. Check the box ‘Show detailed annotation information’. Click Apply and
OK. Then go back to the parsing error and hover over the red under bar. A pop up
will appear displaying what the parser was expecting.

You can also view the annotation in the Problems view tab. If that is not present, you
can open the Problems view tab by clicking the Window menu at the top and click
‘Show View’ and select ‘Problems’.

NOTE: The parser expects all SQL statements to end with a semicolon, ‘;’.

17. I am viewing the SQL (Show DDL) for a table in my schema that contains Kanji
characters, but instead of the Kanji character, it is displaying questions marks.
How can I view the SQL correctly?

This has been reported as a bug in Eclipse, but there is a workaround. You can view
the correct characters by changing the character encoding for your Eclipse
Workspace. Go to the Workspace Preference Page by selecting Window (from the top
menu bar), then Preferences> General > Workspace. Change the Text file encoding
setting to utf8 or utf16 and click Apply. Close the SQL Editor Window and re-run the
Show DDL command.

18. I am getting a Teradata Database error when trying to execute multiple SQL
statements, in the SQL Editor, that contain DDL and DML statements, such as
CREATE TABLE and INSERT. The following error occurs:

[Teradata Database] [TeraJDBC [Link]] [Error 3722] [SQLState


HY000] Only a COMMIT WORK or null statement is legal after a DDL
Statement.

You must choose the ‘Execute as Individual Statements’ menu option when trying to
execute multiple DDL or DML statements. ‘Execute All’ or ‘Execute Selected
Statements’ will attempt to perform all the statements in a single transaction, which
will cause a database error.

Page 7 of 9
Using Teradata Meta Data Services Web Service
19. I have installed Teradata Meta Data Services 13.00.01 (or greater), Apache
Tomcat web server, Metro JARs, and JRE 1.5, but I am still not able to deploy
the Teradata Meta Data Services web service. I am getting the following error:

FAIL – Application at context path /MetaJavaWS could not be started

Make sure that you have run the "[Link]" script found in the Metro
directory when you installed the Metro JARs. This script will create the appropriate
directory in Tomcat and copy the Metro JARs to that directory. It should also modify
the Tomcat configuration file ([Link]) to include the appropriate
directory for sharing libraries when loading classes at startup.

Check to make sure that the Metro JARs have been copied to your Tomcat directory
within your Tomcat installation (C:/Program Files/Apache Software
Foundation/Tomcat 6.0) and that the Tomcat [Link] file (located in the
Tomcat /conf directory).contains a reference to that directory.

Also verify that the JAVA_HOME, TOMCAT_HOME, CATALINE_HOME, and


PATH variables are set correctly.

20. I have configured Teradata Meta Data Services 13.00.01 and started the MDS
web service, but I am getting the following exception when I try to compare
object definitions:

Teradata Browser Exception: User name has not been set in the
preferences

Verify that you have initialized the Meta Data Services user credentials on the
Teradata Dependencies Preferences page. Click on top level Window menu >
Preferences > Teradata Datatools Preferences > Dependencies Preferences. Enter the
MDS Web Services system and user credentials. Click the Test User button to verify
that your Teradata system shows up in the list of database systems. Click Apply and
OK

21. I have initialized the user credentials for my Web Service system on the Eclipse
Teradata Dependencies Preferences page and verified that my Teradata system
shows up in the list of database systems when I press the Test User button. But I
am still getting an exception when I try to compare object definitions.

Teradata Browser Exception: Schema - testdb - objects cannot be


retrieved by Teradata Meta Data Services.

This error indicates that the object you are comparing is not loaded in Meta Data
Services. Verify that you have loaded your schema (in this example, testdb) into the
Meta Data Sservices repository. You can do this by running the Teradata Meta Data
Services MetaManager. If this is the first time running the MetaManager, you will

Page 8 of 9
need to click the Configure button and configure a data source connection to access
your MDS repository database. Then, log in using the MDS User Name and
Password. This is the same MDS username and password you have configured on the
Teradata Dependencies Preferences page. Next, you will see a list of Meta Data
Services systems. Right click on your system and choose the Database
Administration… menu option. Choose the ‘Load Databases’ tab. Select you
schema from the list of available databases, click the Add button, and click Apply.
Click the Proceed button on the next screen. This will begin the process of loading all
the objects in your schema into the MDS repository. This may take some time. When
the process completes, click the OK button to exit the Database Administration.

If you have already loaded your schema into the MDS repository, but have since
added new database objects, such as tables, macros, stored procedures, etc. to your
schema, you will need to resynchronize the MDS repository. In the Teradata Meta
Data Services Administration utility, choose the ‘Resync Database’ tab. Select your
schema from the list of databases, click the Add button and click Apply. Click the
Proceed button on the next screen. This will begin the process of re-synchronizing
your schema into the MDS repository. When the process completes, click the OK
button to exit the Database Administration.

The Compare Definition feature will attempt to use Meta Data Services to obtain the
object dependencies. But if an exception occurs, it will use the default SQL model
relationships to obtain object dependencies and display the following warning
message in the Notification area:

* System(s) [testdb] do not have MDS enabled for Teradata


Dependency Browser

Debugging
22. How do I turn debug tracing on for a particular Eclipse plug-in?

Turning on the Debug option in Eclipse can be done by providing an .options file in
the installed /eclipse directory and launch Eclipse with the –debug option. The
.options file contains the name of the plug-in and a flag that indicates that debug is
turned on. Below are the contents of a sample .options file that will turn debug on for
the [Link] plug-in:

[Link]/debug = true

Page 9 of 9

You might also like