| Author |
Storing multiple values in the Database.
|
Pandurang Shenoy
Greenhorn
Joined: Mar 31, 2003
Posts: 10
|
|
Hello all, I am making use of a parameter in JSP that has multiple values(say 3 different values). I want to store all the values of that parameter in the DataBase under a single column.How can i do that..?If you know,please let me know.. Regards Pandurang
|
 |
Chris Baron
Ranch Hand
Joined: Mar 21, 2003
Posts: 1049
|
|
Hi, given an existing Connection con i didn't test it, but it should work cb
|
 |
Rajeshwari Natarajan
Ranch Hand
Joined: Mar 05, 2003
Posts: 67
|
|
But by Christian Baron's code u'll be trying to execute multiple insert statements. Create a delimiter separated string with all the values u want to insert and then call an insert statement. [ April 03, 2003: Message edited by: Rajeshwari Natarajan ]
|
regards<br />Rajeshwari. N
|
 |
Andy Bowes
Ranch Hand
Joined: Jan 14, 2003
Posts: 171
|
|
If you are going to use the SQL statement many times but with different values you should really use a PreparedStatement rather than a statement. It is a lot faster as the DB doesn't need to re-parse the SQL statement. Example shown below:
|
Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
|
 |
Chris Baron
Ranch Hand
Joined: Mar 21, 2003
Posts: 1049
|
|
Aaah, i was allways wondering what PreparedStatement was good for. Learned something. thx Andy
|
 |
Pandurang Shenoy
Greenhorn
Joined: Mar 31, 2003
Posts: 10
|
|
|
Thanx to all for replying to my Qn..
|
 |
 |
|
|
subject: Storing multiple values in the Database.
|
|
|