db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kosurusekhar <kosurusek...@gmail.com>
Subject RE: number of parameters
Date Thu, 03 Jan 2013 12:39:49 GMT
Hi Pavel,

I understand that you need to pass 92 parameters for you store proc.

Recently i implemented with 86 parameters with help of UDT.

I registered an UDT in derby like this.

Create type MyType
External Name 'yourpackage.MyUDTClassName' Language java
-- This is Java class you need to create with those 92 parameters as local
properties.
your UDT external java class should be implement either Serializable or
Externalizer. 
And also you need to provide serialversionUID if you implement Serializable.

Mainly this UDT java class should be derby classpath before you testing jdbc
client.

Then write the Store proc like this.

create procedure MySP(IN myt MyType)
parameter style java
language java
external name 'yourpackage.yourClass.spMethod'

As part of your store proc we need to write one public static method where
we mentioned in above store proc should be like this.

public static void spMethod(MyUDTClassName myudt) throws SQLException {
   // implement your sp logic here. all 92 parameters is now available with
the method parameter.
}

As per Derby semantics the method which we will write logic for store proc
also should be derby classpath.

To test this store procedure you need to write a JDBC client which as
follows:

// Create connection.
MyUDTClassName myu = new MyUDTClassName(); // Object for my UDT class and
set all 92 parameters.
CallableStatement cs = connection.prepareCall("{call MySP(?)}");
cs.setObject(1, myu);
cs.execute();

My self i tested above things in Network Server Mode. 

Hope this will help you.


Regards
Sekhar.







--
View this message in context: http://apache-database.10148.n7.nabble.com/number-of-parameters-tp126108p126209.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Mime
View raw message