Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Store array in database

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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: 40035
809
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
 
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic