Can a teradata database trigger/stored procedure call a java program or Executable?

Database

Can a teradata database trigger/stored procedure call a java program or Executable?

Hi,

My project requirement is that a Teradata database trigger/stored procedure needs to call java program to put data in a JMS queue. I wanted to know if it is possible to call executable or java program from stored procedure/trigger?

Is java stored procedure supported in Teredata database?

Note: I dont want to write a polling job or program to monitor changes in the tables and then put data in a JMS queue.

Appreciate your help in advance!

Thanks,
Mustaq
5 REPLIES
Enthusiast

Re: Can a teradata database trigger/stored procedure call a java program or Executable?


UDF or Stored procedure? Teradata Stored procedures follow the ANSI standard and have a specific language as per the ANSI standard. Not C, Not Java, it is called Stored Procedure Language. It is very limited in what it can do.

You would probably want to Equate what other vendors call Stored procedure With User Defined Functions. For example In some other RDBMS even simple Teradata Macros are called Stored procedures. I even found an example of a Stored Procedure that could Format a Disk.
What does formatting a Disk have to do with Relational Databases.

Anyway as of V2r5.1 Teradata supports User defined functions. They must be written in C. In V2r6 they can be written in in C or C++, Java support will come later.

However someone offered a suggestion somewhere, if not this Forum maybe TeradataForum.com, where as you write a C Wrapper function to call your Java function. Never tried this.

Obviously this wouldn't be supported on a production system from Teradata's Support Contract point of view ( if it crashes your box ) but It might work.

Re: Can a teradata database trigger/stored procedure call a java program or Executable?

Hi,

Thanks for your prompt response! Would appreciate your comments on these as well:

Here are my project requirements:

1. From a teradata database trigger I need to update different vendor database(SQL server or Sybase) table. Wanted to created something like database link with other vendor database, and manipulate/retreive data.
Note: I dont want to do this by replication and I need something like database link or create something like Oracle java stored procedure.

2. Yes it possible to call java or java webservice from C program. Have couple of questions on macros.
a)Can I call teradata macros from teradata database trigger? Is it possible to make this call asynchronous?

b) Can I set macros on a table that will trigger the macros statements on updation/deletion/insertion of a row in a table?

c) Can I call teradata stored procedure from teradata macros or vice versa?

Thanks for your help!
Enthusiast

Re: Can a teradata database trigger/stored procedure call a java program or Executable?

Sorry We don't support native Java functions. Can you re write the Java function in 'C' using ODBC or something?

V2r6 allows you to write TABLE UDFS where your UDF can return a set of ROWS one at a time to a query that invokes it.

---

Re: Can a teradata database trigger/stored procedure call a java program or Executable?


First, my code will run on unix env, so I cannot go with ODBC.
Second, To write a code to access messaging server or database server in C will take lot development effort and time
Third, most my existing business logic is in java and I want to reuse the code.

My sincere thanks for help!
Enthusiast

Re: Can a teradata database trigger/stored procedure call a java program or Executable?


But ODBC runs on UNIX.

You can download the ODBC driver for Teradata for SOLARIS, LINUX, HPUX, AIX from

http://www.teradata.com/t/page/130536

Like I said you can try writing C Wrapper functions to call into you JAVA DLL .