dolphinscheduler从mysql_to_sqlserver遇到的问题

在使用模版的时候 

datax 从mysql到sqlserver遇到了这个问题:

报错:



      2024-06-07 17:20:16.232 [job-0] INFO  OriginalConfPretreatmentUtil - table:[test3] all columns:[



       mgid



       ].



       2024-06-07 17:20:16.313 [job-0] ERROR JobContainer - Exception when job run



       com.alibaba.datax.common.exception.DataXException: Code:[DBUtilErrorCode-01], Description:[获取表字段相关信息失败.].  - 获取表:test3 的字段的元信息时失败. 请联系 DBA 核查该库、表信息. - com.microsoft.sqlserver.jdbc.SQLServerException: “`”附近有语法错误。

是因为这里加了’

sqlserver不允许这个 

解决方法就是使用自定义模版

{

    "job": {

        "content": [

            {

                "reader": {

                    "name": "mysqlreader",

                    "parameter": {

                        "username": "root",

                        "password": "123456",

                        "connection": [

                            {

                                "querySql": [

                                    "select mgid from test1;"

                                ],

                                "jdbcUrl": [

                                    "jdbc:mysql://172.16.121.108:3306/test?allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"

                                ]

                            }

                        ]

                    }

                },

                "writer": {

                    "name": "sqlserverwriter",

                    "parameter": {

                        "username": "SA",

                        "password": "DTstack@123",

                        "column": [

                            "mgid"

                        ],

                        "connection": [

                            {

                                "table": [

                                    "test3"

                                ],

                                "jdbcUrl": "jdbc:sqlserver://172.16.120.111:1433;databaseName=TestDB"

                            }

                        ]

                    }

                }

            }

        ],

        "setting": {

            "speed": {

                "channel": 1

            },

            "errorLimit": {

                "record": 0,

                "percentage": 0

            }

        }

    }

}

也可以改源码

DataxUtils.java中删除处理SQL服务器模块的代码中的符号“`”。

源代码

案例SQLSERVER:

return String.format(" %s", column);

建议代码

案例 SQLSERVER:

返回 String.format("%s", column); -- 没有符号`

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值