Hello guys,

I am working on a project that deals with a store. but here is my problem i am having problem inserting multiple record into the database instead my code is summing it up.

Can anyone give me an idea on how to insert multiple record into a database.

Thanks.

Recommended Answers

All 3 Replies

Following SQL allows to insert multiple records at a time in database -

INSERT ALL
   INTO mytable (column1, column2, column3) VALUES ('val1.1', 'val1.2', 'val1.3')
   INTO mytable (column1, column2, column3) VALUES ('val2.1', 'val2.2', 'val2.3')
   INTO mytable (column1, column2, column3) VALUES ('val3.1', 'val3.2', 'val3.3')
SELECT * FROM dual;

So in java, create a statement as above and then call the execute() method.
I didn't try it, but hope, it will work. Also let us know the result whether it works or not.

Thanks i really appreciate it i will try it and let you know the latest update thanks once more

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.