开发者

java 1.4 :how to insert multiple records in a database with one single hit using executeBatch?

i am reading records data from a file(records count can be up to thousands ).Now i want to insert each record in to database.I want to insert all of record开发者_开发技巧s in one hit to reduce performance hit. If i use addBatch(String sqlQuery ) on statment object,my sql query should be static .but in my case query will be non static.Please tell me possible solutions with best performance?

platform java 1.4 sql server 2000.


From Wiki

A SQL feature (since SQL-92) is the use of row value constructors to insert multiple rows at a time in a single SQL statement:

INSERT INTO ''TABLE'' (''column1'', [''column2, ... '']) 
VALUES (''value1a'', [''value1b, ...'']), 
       (''value2a'', [''value2b, ...'']), 
   ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜