This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to store an array of Strings into oracle DB using JDBC

 
Radhakrishna Sharma Gorenta
Ranch Hand
Posts: 63
Google App Engine Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i took a String array like this



to store using prepared statement i used


the error is invalid column type
 
Sudheer Bhat
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You haven't told us how you want to store the array in the DB. If you want the entire String array to go into a column in one row, you would need to make use of nested tables.
Google for nested tables and you will find more information for the same.
 
Radhakrishna Sharma Gorenta
Ranch Hand
Posts: 63
Google App Engine Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
thank you.
I want to store an arrary as a coloumn in a table
 
Philip Grove
Ranch Hand
Posts: 68
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I certainly hope you mean that you want to store the array as a row, because column is extremely messy bordering on impossible.

What your code tries to do is write an Object to a single field (column 8) is a row. The underlying database expects the value of the specified column to be of a certain type and your array is not of that type nor can the driver map it to that type.
 
Radhakrishna Sharma Gorenta
Ranch Hand
Posts: 63
Google App Engine Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi philip,
I got it. To store an array object i must create a user defined data type of type VARRAY. And i resolved this one.
Thank you all
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic