java中 我通过jdbc插入数据进入mysql数据库,为什么会报错啊,一般是1000多条以后就报错了,求大神解释!!
Exceptioninthread"main"java.net.SocketException:Connectionresetatjava.net.SocketInput...
Exception in thread "main" java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at com.newHouse.NewHouseTool.publicMethod(NewHouseTool.java:58)
at com.newHouse.NewHouseTool.scanEndDesc(NewHouseTool.java:134)
at com.newHouse.NewHouseTool.scanNextDesc(NewHouseTool.java:91)
at com.newHouse.NewHouseTool.scanDescrupt(NewHouseTool.java:72)
at com.newHouse.NewHouseTool.scanList(NewHouseTool.java:49)
at com.newHouse.NewHouseTool.main(NewHouseTool.java:26) 展开
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at com.newHouse.NewHouseTool.publicMethod(NewHouseTool.java:58)
at com.newHouse.NewHouseTool.scanEndDesc(NewHouseTool.java:134)
at com.newHouse.NewHouseTool.scanNextDesc(NewHouseTool.java:91)
at com.newHouse.NewHouseTool.scanDescrupt(NewHouseTool.java:72)
at com.newHouse.NewHouseTool.scanList(NewHouseTool.java:49)
at com.newHouse.NewHouseTool.main(NewHouseTool.java:26) 展开
展开全部
你的tomcat是6.0.18以后的版本么?6.0.18版本以后的tomcat有一个防内存泄露机制,它会强行把jdbc连接给注销掉。如果是,建议换低版本的tomcat
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
连接重置,是不是网速太慢了。
或者你每次插入小于1000条,插完后再重新插入另外的
或者你每次插入小于1000条,插完后再重新插入另外的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
端口连接异常,多种情况会导致这个错误,做好看见你的源码
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
是批量插入还是一条一条的,如果是一条一条插入,检查下每次插入完有没有关闭连接。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
建议使用jndi连接方式,通过jdbc-odbc的方法进行数据库连接,是连接一次创建一次的做法
,jdbc连接之后需要关闭之后的连接进程
,jdbc连接之后需要关闭之后的连接进程
追问
jndi连接方式 ?? 没用过 是要设置的 还是怎么弄??
追答
需要配置,建议上网查一下具体的jndi使用方法,很简单,jndi方式每个数据库都支持,就是有固定的接口,配置一下就行了。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询