[ 
https://issues.apache.org/jira/browse/DERBY-4467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12788934#action_12788934
 ] 

Rick Hillegas commented on DERBY-4467:
--------------------------------------

Hi Shazin,

I think this is a really cool technique. As I understand it, you have provided 
some code to enable the following:

1) Declare an external procedure which is written in a scripting language that 
runs on the VM...

2) ...and include the source code for that procedure inline in the SQL 
statement which declares the procedure

Dag has raised an interesting point:

a) God-like powers are conferred on any user who can declare and execute the 
CREATE_PROCEDURE proc.

I can see other possibilities for this technique, in particular, support for 
table functions that are coded in scripting languages.

At a minimum, we can refer users to your code as an example of how to declare 
dynamic, inline routines written in scripting languages. I would have to give 
some thought to whether we could integrate this more tightly in Derby. Let me 
push your proposed syntax forward a bit more. Bear with me because I'm not very 
familiar with the specifics of these scripting languages:

create function foo( a int, b varchar( 100 ) )
returns double
language javascript
parameter style derby_scripting_style
external name '...'

The elipsis is where you would put your inline scripting code. I don't know 
what the meaning of the function arguments would be, however. Can you give us 
an example of how you would map SQL parameters to arguments that are passed to 
the script interpreter?

Thanks!



> Non Java Stored Routines Using Java Scripting API
> -------------------------------------------------
>
>                 Key: DERBY-4467
>                 URL: https://issues.apache.org/jira/browse/DERBY-4467
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>         Environment: Windows XP, Java 1.6
>            Reporter: Shazin Sadakath
>            Priority: Minor
>         Attachments: DDL.sql, DerbyStoredRoutine.zip, ScreenShot.JPG
>
>
> I have been working on an idea that lets you create Stored Procedures using 
> languages other than Java with a perspective of Apache Derby as a Network 
> Server. I tried this by using Sun Java Scripting API for JRE 1.6+ and Apache 
> BSF http://jakarta.apache.org/bsf/ for JRE 1.4+.
> This has certain advantages when it comes to compiled java stored routines.
> 1. It is dynamic.
> 2. Requires no configuration of classpath.
> 3. Requires no use of SQLJ.INSTALL_JAR and SQLJ.REPLACE_JAR.
> 4. Very easy to maintain
> 5. Allows the use of Sun Java Runtime Library via Object Binding.
> 6. Supports JavaScript, Jython, Dynamic Java and many more scripting 
> languages. https://scripting.dev.java.net/
> 7. No need of introducing a new SQL/PSM grammar to the current SQLParser.
> There are two approaches for this enhancement. 
> 1. Having this as an external utility component such as ij, dblooks
> 2. Having this as a built in feature.
> I have done this in the former method for demonstration purpose.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to