求教大神关于j2ee插入mysql大量数据的问题
防伪查询系统有1000W条记录要插入,里面有:防伪查询号码(加密生成后的非连续10位混乱数字),号码对应的厂家,号码对应产品图片,已被查询次数四个字段,
请教该如何插速度能快点,防伪号码在一个记事本里面一行一个,我做的是按行取查询号码,然后一条一条插入,但是速度极慢,而且还说超过了windows socket 最大连接数,mysql.ini里面的最大连接数已经到1000了,运行状态显示1000绝对够用,插入进行到1000多条的时候就走不下去了。
为了防止查询过慢,我用查询码的前四位做索引。这样每个表最多有100W条数据。
myeclipse报错如下:
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The driver was unable to create a connection due to an inability to establish the client portion of a socket.
This is usually caused by a limit on the number of sockets imposed by the operating system. This limit is usually configurable.
For Unix-based platforms, see the manual page for the 'ulimit ' command. Kernel or system reconfiguration may also be required.
For Windows-based platforms, see Microsoft Knowledge Base Article 196271 (Q196271).
请高手指点迷津,不胜感激!!
[解决办法]
学会了,用批量语句,1000W数据只要14分钟