Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Vectors

 
steph rinert
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help,
I am using a vector to insert some data into a database but since a vector is wrapped in brackets, I do not get desired affects. Is there a way of inserting a vector into an Oracle DB without inserting the [] brackets thats comes with a vector.
Thanks
 
steph rinert
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ohh and I wanted to insert the entire vector and not have to go though field by field.
 
Michael Zalewski
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are writing the Vector into a single column, single row in the database, you could always override the Vector.toString() method to get rid of the brackets:

You can also use the copy constructor just before you write to the database:

Aren't inner classes neat?
 
steph rinert
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This worked great,
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic