• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Store array in database

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to store an array in an Oracle database. I'm not sure if I should be using blob or clob and more important, I have not been able to find an example of storing an array. Is this even possible?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bill,
An array of what? The data structure to store depends on what is in the array.
 
Bill Hayes
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll be storing an array of strings. I know I can simply store a delimted string in a regular varchar field then use StringTokenizer. But storing an array sounded interesting. If coding the storage of array is a really big effort I will probably go the StringTokenizer way. I just wanted to give it one last chance before giving up.
Thanks.
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you serialize the object then you can use a BLOB
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oracle has support for collections. It's very much possible to store the array/collections. You have two options
1. Create new types in oracle and change your JDBC calls to use Oracle specific classes. This might be big effort based on your need.
2. Create new types in oracle and use stored procedure to do all DML and Select.

These links will help you
http://download.oracle.com/docs/cd/B10501_01/java.920/a96654/oraarr.htm
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/05_colls.htm
and other chapters in PL/SQL user guide
reply
    Bookmark Topic Watch Topic
  • New Topic