The driver was unable to create a connection due to an inability to establish the client portion of

The driver was unable to create a connection due to an inability to establish the client portion of

在Windows上与MySQL服务器的连接失败(大数据量)

发生的异常:

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).

 

 

原因与解决方法:

 

1.操作系统对半连接数的限制。

 

这个可以使用迅雷菜单中的工具进行修改,或者使用tcpz软件来修改,其他的如:XP优化工具也有这个功能。

 

2.经过以上的修改还是发生异常

 

这个从MySQL的官方帮助文档中,有如下:

 

当你在具有很多TCP/IP连接的Windows上运行MySQL服务器,并经常在客户端上遇到“无法连接到MySQL服务器”错误时,可能是因为Windows不允许足够的临时(短命)端口用于这类连接。

默认情况下,Windows允许用于使用5000个临时(短命)TCP端口。任何端口关闭后,它将在TIME_WAIT状态保持120秒。与重新初始化全新的连接相比,该状态允许以更低的开销重新使用连接。但是,在该时间逝去前,无法再次使用该端口。

对于小的可用TCP端口堆栈(5000),以及具有TIME_WAIT状态的大量在短时间内打开和关闭的 TCP端口,你很可能遇到端口耗尽问题。处理该问题的方法有两种:

·        通过调查连接池以及可能的持久连接,减少快速消耗的TCP端口数。

·        调整Windows注册表中的某些设置(请参见下面)。

要点:下述步骤涉及更改Windows注册表。更改注册表之前,请备份注册表,并确认你已掌握在出现问题时恢复注册表的方法。关于备份年、恢复和编辑注册表的更多信息,请请参见Microsoft知识库中的下述文献:http://support.microsoft.com/kb/256986/EN-US/

·        启动注册表编辑器(Regedt32.exe)。

·        在注册表中确定下述键值的位置:

·               HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

·        在“编辑”菜单上点击“添加值”,然后增加下述注册值:

·               Value Name: MaxUserPort·               Data Type: REG_DWORD·               Value: 65534

它用于设置为任何用户提供的临时端口数。有效范围介于5000和65534之间(十进制)。默认值为0x1388(5000,十进制)。

·        在“编辑”菜单上点击“添加值”,然后增加下述注册值:

·               Value Name: TcpTimedWaitDelay·               Data Type: REG_DWORD·               Value: 30

它用于设置关闭之前将TCP端口连接保持在TIME_WAIT状态的秒数。有效范围介于0秒和300秒之间。默认值为0x78(120秒)。

·        退出注册表编辑器。

·        重新引导机器。

注释:撤销上述设置十分简单,就像删除你创建的注册表一样。

 

 

经过以上的修改,OK!

 

呵呵,上面的问题主要还是连接问题,也可以用批量数据插入或者使用连接池


附jdbc连接池下载:http://download.csdn.net/detail/zl386119974/7503731

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Shifts in China’s Rural and Urban Population: 2000-2020 The bar chart clearly reveals that from 2000 to 2020, while the total population in China increased moderately from 1.25 billion to 1.41 billion, population in urban and rural areas experienced dramatic shifts in different directions. Urban population rose from 450 million in 2000 to 670 million in 2010 and 900 million in 2020; contrastingly, rural population declined from 800 million in 2000 to 680 million in 2010 and 510 million in 2020. The population gap narrowed largely because of the joint effects of urbanization, unequal economic opportunities in rural and urban areas, and the expansion of higher education. In the first place, there was a large-scale urban sprawl during this period. Places which had been part of the vast countryside were incorporated into cities, causing hundreds of millions of rural dwellers to be passively transformed into urban residents. What’s more, while urban living standards improved greatly in these years, few economic opportunities fell on rural areas and most peasant families remained at the poverty line. Poverty prompted the call for change, leading a large quantity of healthy young peasants to leave their hometowns and flock to cities for a better living. Last but not least, China’s higher education grew at an unprecedented rate in these years. More high school graduates than ever before entered colleges and universities, most of whom preferred to stay in urban areas after graduation for personal development. The increase in urban population was a sure indication of economic and educational achievements in China. It benefited the country in many aspects, relieving the shortage of labor force in cities, lessening the burden of peasants to support their families, and affording young people from rural areas more opportunities to display their talents. However, the migration of rural residents into urban areas inevitably brought about disadvantages. Some of them, such as waste of arable land and left-behind children in the countryside, as well as traffic congestion and soaring housing prices in cities, have already called the attention of the government and corresponding measures have begun to take effect. But others, especially the inability of many peasants to integrate into urban life due to their lack of education and civilized habits, have long been neglected. In this sense, we cannot be satisfied with the superficially optimistic figures in the chart, but should endeavor to foster the integration of these newcomers by providing them with adequate assistance in educational and cultural aspects, so that they can find easier access to the prosperity and convenience of urban life and be more fully devoted to the development of cities.翻译成英文版两百单词左右的文章
02-21

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值