jdbc无法获取连接

plugin 发布于 2016/10/08 00:40
阅读 301
收藏 0

```
  0      0 10.133.198.144:mysql        121.4.70.99:59428           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59477           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59438           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59479           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59578           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59450           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59424           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59451           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59458           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59589           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59436           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59460           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59554           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59526           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59594           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59467           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59435           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59453           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59573           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59475           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59471           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59472           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59611           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59434           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59476           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59527           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59452           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59494           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59586           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59430           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59520           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59615           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59593           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59606           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59576           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59519           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59440           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59448           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59556           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59575           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59558           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59574           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59581           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59553           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59616           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59473           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59481           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59425           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59566           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59555           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59462           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59561           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59518           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59585           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59600           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59584           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59437           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59570           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59572           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59599           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59557           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59468           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:ssh          121.4.70.99:58031           ESTABLISHED 4271/sshd           
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59590           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59563           TIME_WAIT   -                   
tcp        0   6000 10.133.198.144:ssh          121.4.70.99:49420           ESTABLISHED 2311/sshd           
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59493           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59579           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59465           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59612           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59587           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59474           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59571           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59591           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59480           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59470           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59506           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59580           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59610           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59598           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59588           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59614           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59433           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59443           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59464           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59583           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59508           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59516           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59602           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59469           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59466           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59525           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59608           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59482           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59545           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59423           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59517           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59429           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:60836        10.252.232.22:nsesrvr       ESTABLISHED 2255/secu-tcs-agent 
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59603           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59521           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59507           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59562           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59577           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59461           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59565           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59427           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59592           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59559           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59439           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59607           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59567           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59457           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59445           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59483           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59551           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59478           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59552           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59495           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59444           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59604           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59459           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59484           TIME_WAIT   -                   
tcp        0      0 10.133.198.144:mysql        121.4.70.99:59449           TIME_WAIT   -   
```

我的配置如下:

```
  <bean id="dataSource"  class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="com.mysql.jdbc.Driver"/>
        <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/haoyinduo?characterEncoding=utf-8&amp;useSSL=true"/>
        <property name="user" value="root"/>
        <property name="password" value="xx@xx"/>
        <property name="initialPoolSize" value="3"/>
        <property name="maxPoolSize" value="10"/>
        <property name="maxIdleTime" value="30"/>
    </bean>
```



上面是查看的连接,刚刚运行的项目怎么会有这么多的连接?

下面是我的配置。

在本地没有这个问题。

最后报jdbc无法获得连接的错误


加载中
0
高山流水情
高山流水情
会不会获取连接后没有关闭啊?
0
szwx855
szwx855
你的代码要么数据源没通过spring管理。要么是手动写的jdbcUtils没有finally connection.close()
szwx855
szwx855
有多线程么,与数据库交互的代码贴出来看下。另外数据源源的spring配置也贴下出来看看。
plugin
plugin
没有啊。我都是交给spring管理的
返回顶部
顶部