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

Inserting data from a string array into an Oracle database

 
Sam Tucker
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings.

I have a string array that has n values which I would like to insert into an Oracle database (having n columns).

I am yet to do any kind of testing of sorts, but I would like to know if the type conversion of the specific column in the Oracle table takes place automatically? (i.e Yorn, Decimal, Amount etc..) or does my Java code need to do that explictly, and if so how can I do it?

Thats is, lets say if I have the value 0 or 1, stored as a string array with index [4]...how do I convert this to a Yorn type before I insert it into the Oracle table from my Java program.

Any help would be greatly appreciated.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam,
Welcome to JavaRanch!

It depends on whtat you have in the String array. Are the formats correct? For example, does the column corresponding to the yes or no value contain "y" or "n" ?

Most drivers are pretty forgiving about calling setString() on non-String types. However, you have to be much more careful to get the format of the values right. Especially for date and time values.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic