Doris2.1.5版本SQL查询失败报错Initialize datasource failed,如何解决?

Viewed 44

Doris版本2.1.5

报错信息如下:
errCode = 2, detailMessage = (ali-doris-prod-03)[CANCELLED]JdbcExecutorException: Initialize datasource failed: CAUSED BY: CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. CAUSED BY: SocketException: Connection attempt exceeded defined timeout.

SQL语句如下:

# 内部表
ad_link.huan_ad_link_direct_log
ad_monitor.huan_ad_monitor_impression_log

# mysql catalog外部表
mysql_ad_link.ad_link.ak_ad_position 

SELECT A.traffice_source_name traffice_source_name,C.name name,C.ad_id ad_id,A.pv req_pv, B.imp_pv imp_pv, round(imp_pv*100/A.pv,0) imp_rate 
FROM ( 
      SELECT dt,traffice_source_name,ad_id,COUNT(1) pv  
       FROM ad_link.huan_ad_link_direct_log haldla 
       WHERE dt = '2024-08-03' AND traffice_source_name IN ('TCL','长虹','东芝','三洋','苏宁SDK') AND res_code = '200' 
       GROUP BY dt,traffice_source_name,ad_id  ) A 
LEFT JOIN 
     ( SELECT dt, hAdId,COUNT(1) imp_pv  
       FROM ad_monitor.huan_ad_monitor_impression_log haldla 
       WHERE dt = '2024-08-03'  GROUP BY dt, hAdId ) B 
ON A.ad_id = B.hAdId 
INNER JOIN 
     ( SELECT ad_id,name 
       FROM mysql_ad_link.ad_link.ak_ad_position  
       WHERE material_type IN (1,3) ) C 
ON A.ad_id = C.ad_id 
WHERE A.pv > 0
1 Answers
  1. 排查一下网络是否能正常通信
  2. 把连接mysql的jar包升级到8.0.30及以上(fe和be的jdbc_drivers目录下)