aspose file tools*
The moose likes JDBC and the fly likes inserting values from arraylist to the database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "inserting values from arraylist to the database" Watch "inserting values from arraylist to the database" New topic
Author

inserting values from arraylist to the database

shriganesh kakade
Greenhorn

Joined: May 10, 2012
Posts: 23
I want to insert the values from the arraylist to the database.
I am using string buffer.
I am new to this.
Please help.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

have you done any jdbc before? if not then start with the JDBC tutorial: http://docs.oracle.com/javase/tutorial/jdbc/index.html.

If you have done some, and are asking about batch inserts this thread has a pretty good answer in it: http://www.coderanch.com/t/306812/JDBC/java/Batch-Insert.

If you have any other queries please give more detail of your question.
shriganesh kakade
Greenhorn

Joined: May 10, 2012
Posts: 23
Hi..
Thank you for your reply.
I had read the link you provided. I am aware of JDBC, I had done it before.
I had the same problem that is in second link you provided.
Want to add the two arraylists to two different tables with the same foreign key consider emp_id.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

so we will do this 1 table at a time.
is this one arraylist updates 1 table? or bits of both arraylist are needed to update the table?

Have you got any thoughts at all about how to start this?
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

The linked thread regards performance problems and honestly, the given solution is not the best you can achieve in Oracle.

Do you have performance problems, or is it something else? Are you on Oracle as well?
shriganesh kakade
Greenhorn

Joined: May 10, 2012
Posts: 23
one list updates one table at a time, i.e. both lists update two different tables..
and i am using mysql server.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

do you have the sql statement for updating a single row?
can you show us that so we have something to work upon building up the batches for MQSQL
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

I am splitting your thread out into a new discusion for the servlets forum, as this doesn't sound much like JDBC anymore
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

shriganesh kakade,
Your post was moved to a new topic.
split from a jdbc thread about batch inserts
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: inserting values from arraylist to the database