File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I Insert vector elements into a DB??

 
john Phillips
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all you java Geniuses.
I have been trying to do the following task for some time now
can anybody pls help me on how to go about it ,Here is the task
I want to insert all the selected records from tableA into tableB
both tables are in the same database and have the same table structure.
They both have about 6 columns each.I'm using a vector to store all the
results returned by table A ,then use a for loop to loop trough the vector
and at the same time convert the Vector to a String variable so that I can Insert them into TableB but I have a problem identifing each of the elements so as to know which one will be currently inserted into the right column out of the six columns on Table B.
[ October 14, 2004: Message edited by: john Phillips ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm. Why do this when this line of SQL:

will do it for you?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the SQL technique is the best, but if for some reason you can't do this, then just don't process the information so much. Take the results directly from the ResultSet, and feed them to a PreparedStatement; this way you can let Java do most of the detail work for you.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic