Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes saving list of strings to one column? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "saving list of strings to one column?" Watch "saving list of strings to one column?" New topic
Author

saving list of strings to one column?

rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
Hi,
I am using db2. I am wondering if it is possible
to save a list of strings to one column of a table?
I can create another table which stores a list of rows
containg individual strings and a foreign key to its parent
table.But I think its overkill to do so. It would be
much simpler just to save a list of strings to one column.
Is it possible?
thanks
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
You can just concatenate the Strings using the overloaded "+" operator.
rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
Thanks for your reply. But this is not what I wanted.
I guess I will create a child table for that if there is no better soulution.
Originally posted by Jeffrey Hunter:
You can just concatenate the Strings using the overloaded "+" operator.
Brahim Bakayoko
Ranch Hand

Joined: Aug 29, 2003
Posts: 155
Use a nested table or an object column type or concatenate the strings with an abitrary delimiter. Then, use a StringTokenizer to get the individual strings when retrieved.


SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="http://webtools.servehttp.com" target="_blank" rel="nofollow">http://webtools.servehttp.com</a> down for a while...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: saving list of strings to one column?
 
Similar Threads
saving nclob data into database
Save list of objects in one shot
CMP maping - one to many unidirection in wl7.0
display error in datatable
adding a column to a JTable