mybatis 调用mysql存储过程报错:Borrow callableStatement from pool failed
之前在测试环境一切正常,切到生产环境的时候就报这个错。mybatis代码  <select id="statisticsConversation" statementType="CALLABLE">
   {call conversation_count}
  </select>
存储过程代码BEGIN
insert into oc_conversation_count
SELECT
UUID_SHORT(),
shop_id,
group_id,
RIGHT(DATE_FORMAT(create_time, '%Y-%m-%d %H'),2),
LEFT(DATE_FORMAT(create_time, '%Y-%m-%d %H'),10),
dst_id,
count(DISTINCT visitor_ip),
count(*),
sum(msg_count),
SUM(viewer_msg_count),
sum(customer_msg_count),
sum(CASE WHEN effective =1 THEN 1 else 0 end),
sum(CASE WHEN effective =0 THEN 1 else 0 end),
sum(CASE WHEN is_connected =0 THEN 1 else 0 end),
NULL,
NULL,
sum(CASE WHEN closetype = 1 THEN 1 else 0 end) seatclose,
sum(CASE WHEN closetype = 2 THEN 1 else 0 end) cusclose,
sum(CASE WHEN closetype = 3 THEN 1 else 0 end) transclose,
sum(CASE WHEN closetype = 0 THEN 1 else 0 end) toclose,
sum(CASE WHEN opinion = 4 THEN 1 else 0 end) great,
sum(CASE WHEN opinion = 3 THEN 1 else 0 end) good,
sum(CASE WHEN opinion = 2 THEN 1 else 0 end) normal,
sum(CASE WHEN opinion = 1 THEN 1 else 0 end) bad,
sum(CASE WHEN opinion = 0 THEN 1 else 0 end) terrible,
sum(CASE WHEN suggest IS NULL THEN 1 else 0 end) notsuggest
FROM
oc_chat
where create_time>CONCAT(DATE_FORMAT(DATE_ADD(NOW(),INTERVAL -1 DAY),'%Y-%m-%d'),' 00:00:00') and create_time<CONCAT(DATE_FORMAT(DATE_ADD(NOW(),INTERVAL -1 DAY),'%Y-%m-%d'),' 23:59:59')
GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d %H'),group_id,dst_id;END
个人觉得应该是JDBC或者是mybatis的错,存储过程单独运行也是正常的

解决方案 »

  1.   

    如果有这个错误的话:
    Caused by: java.sql.SQLException: User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configure connection with "noAccessToProcedureBodies=true" to have driver generate parameters that represent INOUT strings irregardless of actual parameter types.参考:
    http://stackoverflow.com/questions/986628/cant-execute-a-mysql-stored-procedure-from-java