• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Retreiving data from Table_A and at the same time inserting into Table_A

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to retreive data from a database and insert into the same database but a different table on the database.
The idea is I want to treive data from Table_A and regarding what I have in the resultSet ,I'll insert into Table_2 that's the second table in the same database,I try using vector as a placeholder for the resultSet but accessing all the data from the first row to the last row is where i have an issue ,I use for loop to loop through the elements and i was able to display the last record on Table_A and I don't have clue of how to insert into Table_B
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question doesn't make any sense in the "meaningless drivel" forum, so I'm monving it to JDBC.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This is just a sample I am giving.
Open connection.
Read data from ResultSet to some Strings, Integers as of ur request.
Fire insert statement for each row want u read
While (Reading Table A resultSet)
{
//Talkeing the result row into java variables.
String ..
String..
con.execute (Fire insert for each row into table B)
}
is it clear?
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic