This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes put Data from Vector into DB. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "put Data from Vector into DB." Watch "put Data from Vector into DB." New topic
Author

put Data from Vector into DB.

tom1978
Greenhorn

Joined: Sep 08, 2002
Posts: 7
Hi,
for my current application i want to add Data to a Database. This data is stored in a Vector. Does anyone have an idea, how to do with (eg. loop).
I would be very happy about a code sample.
Greetings tom
tom1978
Greenhorn

Joined: Sep 08, 2002
Posts: 7
Vector or Object[][] ( is as well possible)
Chandresh Patel
Greenhorn

Joined: Jul 05, 2002
Posts: 14
You can use Batch Inserts.


Chandresh
Bill White
Ranch Hand

Joined: Oct 27, 2002
Posts: 82
// Create Connection and Statement object
Iterator iter = myVector.iterator();
while(iter.hasNext())
{
myObject = (MyObject)iter.next();
String sql = "whatever type of sql you need";
statement.addBatch(sql);
}
statement.executeBatch();
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: put Data from Vector into DB.
 
Similar Threads
writing to file from Vector
Booking method
display data page vise
Vector within vector
Jtable boolean checkboxes