当前位置:编程学习 > JAVA >>

Spring getJdbcTemplate().query 访问数据库 没有返回

Spring  getJdbcTemplate().query 访问数据库 没有返回 具体出错的情形情况是
多线程操作 
线程A 用Spring  getJdbcTemplate().update 去删除一个表中的数据
线程B 同一时间 用 getJdbcTemplate().query 去查询数据

观察到的现象是 删除操作执行时间较早 顺利完成
但是 getJdbcTemplate().query 的查询操作 却一直没有返回查询数据, 一直到 28800 s 即8个小时 
以后 才因为连接超时 被数据库自动断掉连接, 连接池用的 proxool 
请 熟悉的人 帮忙 谢谢
--------------------编程问答-------------------- 命令发出时的日志
11-09-07 23:00:10 666  com.aviva.transcode.threadService.BufferWorkPushPopThreadOneTime.run(BufferWorkPushPopThreadOneTime.java:31)
++++++BufferWorkPushPopThreadOneTime::run()++++++

8小时以后的连接断掉的日志
11-09-08 07:00:26 090  com.aviva.transcode.threadService.BufferWorkPushPopThreadOneTime.run(BufferWorkPushPopThreadOneTime.java:50)
error++++++BufferWorkPushPopThreadOneTime::run()++++++PreparedStatementCallback; uncategorized SQLException for SQL [SELECT coder.id, coder.ip, coder.port, coder.transcoderComment, coder.postfix, coder.receivePort, coder.receivePostfix, coder.status AS coderStatus, code.id AS jobId, code.ttid, code.begin, code.end, code.sourceType, code.sourcePathPrefix, code.sourcePath, code.videoCodeType, code.audioCodeType, code.outputSize, code.frameRate, code.codeRate, code.savePath, code.outputType, code.outputAddress, code.status, code.runStatus, code.recordChannelId, code.channelProgramId, rc.physicalChannelId, cp.name FROM transcodeJob AS code LEFT OUTER JOIN transcoder AS coder ON code.transcoderId = coder.id LEFT OUTER JOIN recordChannel AS rc ON code.recordChannelId = rc.id LEFT OUTER JOIN channelProgram AS cp ON code.channelProgramId = cp.id where  ((code.begin between ? and ?) OR ((code.begin <= ?) and (code.end > ?))) ]; SQL state [08S01]; error code [0]; The last communications with the server was 28809 seconds ago, which  is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.; nested exception is com.mysql.jdbc.CommunicationsException: The last communications with the server was 28809 seconds ago, which  is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

--------------------编程问答-------------------- 正常情况下 无论如何 getJdbcTemplate().query  应该返回的呀,不应该等到 超时 什么也不返回,什么原因那? --------------------编程问答-------------------- 怎么没人关注 --------------------编程问答--------------------
你这样不把人搞晕了啊,什么代码 --------------------编程问答-------------------- 再顶一下
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,