?
Solved

java data structure into stored procedures

Posted on 2007-04-05
6
Medium Priority
?
196 Views
Last Modified: 2010-03-31
Is it possible to pass Java data objects to  stored procedures?

I have a stored procedure framework that accepts in parameters and returns ouput..but now ..I have a huge data structure of 150 fields to be passed in as input parameters which makes it impossible to type all that in the SP as input.. How do I do this?

0
Comment
Question by:skn73
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 3

Expert Comment

by:cavey_79
ID: 18857750
Quick answer...you can't. You will probably need to create a single value (like a huge comma separated string) that you would pass into the stored procedure.
Then, in the stored procedure, you would parse it and split it into little pieces.

You can also try having 150 parameters to the stored proc, however that might be a problem with some databases that will limit the number of parameters to a stored proc.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18861133
Even if it is possible, its not advisable either because then you limit yourself to only those databases which support Java objects. You won't be able to port or migrate to other databases. I would say keep the application layer generic of the database and let the DAO layer communicate with the database using stored procedures by passing data in the form of whatever complies with plain SQL specifications
0
 

Author Comment

by:skn73
ID: 18863568
I dont agree its not possible at all .. there should be some way ..
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 2000 total points
ID: 19011120
You can pass Java objects to stored procedures but that would heavily tie your application to the database and I would say that is bad architecture:

http://forum.java.sun.com/thread.jspa?threadID=757466
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question