aspose file tools*
The moose likes JDBC and the fly likes Passing array to CallableStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Passing array to CallableStatement" Watch "Passing array to CallableStatement" New topic
Author

Passing array to CallableStatement

Nidhi Singhal
Ranch Hand

Joined: Sep 19, 2004
Posts: 89

Hi

i am using CallableStatement to call an Oracle stored procedure.
i want to pass an array to the procedure (as 'In' parameter).

in java, i have declared my array as follows..
String arr_ctr[] = new String[10];

Please tell me how to pass this array to the Oracle stored procedue using Callable Statement from java servlet.

Please help me out...

Thanks....

Nidhi
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

what is signature of your stored procedure


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
rahul V kumar
Ranch Hand

Joined: May 20, 2003
Posts: 82
What is your database?

You could do something like this.

1) Create a Type on your database. On oracle it would be something like this
type VARCHAR2_TABTYPE as table of varchar2(1000);
2)


hope this helps.
Udayan Patel
Ranch Hand

Joined: Oct 14, 2004
Posts: 94
Originally posted by rahul V kumar:
What is your database?

You could do something like this.

1) Create a Type on your database. On oracle it would be something like this
type VARCHAR2_TABTYPE as table of varchar2(1000);
2)


hope this helps.


If you want to do it go for it but it is not a good idea, to bind your application to a specific database and driver.
rahul V kumar
Ranch Hand

Joined: May 20, 2003
Posts: 82
I am not suggesting to bind to a database nor a driver.

What I tried to point out is that , this is the way it could be done on oracle. I hope on SQL Server too you have some mechanism to create a "TYPE" object.

And you need this "TYPE" object because ArrayDescriptor needs one.

Hope this helps
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

This is not a Servlet question, moving it to JDBC.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61226
    
  66

"Nidhi S",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: Passing array to CallableStatement