DataX 求助:sqlserver reader报错,connection rest

o8x7eapl  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(132)

求助:使用sqlserver reader读取时报错 Connection reset,详细如下:

对方是其它厂家维护的库版本为sql server 2008 r2,本机通过python脚本通查询到数据。尝试过如下排查,未解决。

  1. 开始以为是驱动不兼容,尝试更换plugin/reader/sqlserverreader/libs/sqljdbc4-4.0.jar为sqljdbc42.jar、mssql-jdbc-7.2.2.jre8.jar
  2. 尝试在json配置中,按querySql的方式,按column+table的方式

详细错误日志

[INFO] 2023-06-13 10:10:43.869 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.datax.DataxTask:[66] -  -> 2023-06-13 10:10:43.118 [taskGroup-0] INFO  TaskGroupContainer - taskGroupId=[0] start [1] channels for [1] tasks.
	2023-06-13 10:10:43.168 [taskGroup-0] INFO  Channel - Channel set byte_speed_limit to 1048576.
	2023-06-13 10:10:43.169 [taskGroup-0] INFO  Channel - Channel set record_speed_limit to -1, No tps activated.
	2023-06-13 10:10:43.449 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[0] attemptCount[1] is started
	2023-06-13 10:10:43.502 [0-0-0-reader] INFO  CommonRdbmsReader$Task - Begin to read record by Sql: [select pznm, flbh, pzbh, lxbh, bmbh, bmmc, xmbh, xmmc, pzrq, kmbh, kmmc, zy, jje, dje, qyf from V_XMPZB;
	] jdbcUrl:[jdbc:sqlserver://172.16.204.150:1433;DatabaseName=zjk].
	2023-06-13 10:10:43.696 [0-0-0-reader] ERROR ReaderRunner - Reader runner Received Exceptions:
	com.alibaba.datax.common.exception.DataXException: Code:[DBUtilErrorCode-06], Description:[执行数据库 Sql 失败, 请检查您的配置的 column/table/where/querySql或者向 DBA 寻求帮助.].  - 执行的SQL为: select pznm, flbh, pzbh, lxbh, bmbh, bmmc, xmbh, xmmc, pzrq, kmbh, kmmc, zy, jje, dje, qyf from V_XMPZB; 具体错误信息为:com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset
		at com.alibaba.datax.common.exception.DataXException.asDataXException(DataXException.java:26) ~[datax-common-0.0.1-SNAPSHOT.jar:na]
		at com.alibaba.datax.plugin.rdbms.util.RdbmsException.asQueryException(RdbmsException.java:97) ~[plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
		at com.alibaba.datax.plugin.rdbms.reader.CommonRdbmsReader$Task.startRead(CommonRdbmsReader.java:220) ~[plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
		at com.alibaba.datax.plugin.reader.sqlserverreader.SqlServerReader$Task.startRead(SqlServerReader.java:79) ~[sqlserverreader-0.0.1-SNAPSHOT.jar:na]
		at com.alibaba.datax.core.taskgroup.runner.ReaderRunner.run(ReaderRunner.java:57) ~[datax-core-0.0.1-SNAPSHOT.jar:na]
		at java.lang.Thread.run(Thread.java:748) [na:1.8.0_262]

277446.log

277444.log

本机上python脚本正常运行

import pymssql
import os

server = '172.16.204.150'
user = "cwczjk"
password = "xxxx"
database = "zjk"
conn = pymssql.connect(server, user, password, database)

sql="select pznm, flbh, pzbh, lxbh, bmbh, bmmc, xmbh, xmmc, pzrq, kmbh, kmmc, zy, jje, dje, qyf from V_XMPZB"

cursor = conn.cursor()
cursor.execute(sql)
rows = cursor.fetchall()

print("run sql: " + sql)
print("result number: " + str(len(rows)))
print("first row: ")
print(rows[0])
cursor.close()
conn.close()

python脚本运行结果:

run sql: select pznm, flbh, pzbh, lxbh, bmbh, bmmc, xmbh, xmmc, pzrq, kmbh, kmmc, zy, jje, dje, qyf from V_XMPZB
result number: 6139
first row: 
('2310001', 5, '001 ', '01', '30', '基建处', '1002', '水电费', '20105', '72010102', '项目支出', '2022年12月办公电费', Decimal('303841.6000'), Decimal('0.0000'), '1')
c8ib6hqw

c8ib6hqw1#

加一下连接参数试试;
encrypt=false;trustServerCertificate=true

相关问题