DataX二次开发——(8)rdbms的达梦8数据库的支持

1 前言

目前GitHub上的DataX3.0开源版本,rdbms里面默认是达梦7的驱动,因此,如果像链接达梦8需要替换驱动。

2 驱动替换

1、下载Dm8JdbcDriver18-xxxx.jar,放到libs下面
DataX二次开发——(8)rdbms的达梦8数据库的支持_第1张图片
2、修改maven依赖,注释dm7的驱动,改成达梦8

        <dependency>
            <groupId>com.damenggroupId>
            <artifactId>Dm8JdbcDriver18artifactId>
            <version>8.1.1.49version>
            <scope>systemscope>
            <systemPath>${basedir}/src/main/libs/Dm8JdbcDriver18-8.1.1.49.jarsystemPath>
        dependency>

        
        
        
        
        
        
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.damenggroupId>
                <artifactId>Dm8JdbcDriver18artifactId>
                <version>8.1.1.49version>
            dependency>
        dependencies>
    dependencyManagement>

3、重新打包编译

mvn -U clean package assembly:assembly -Dmaven.test.skip=true

3 读写达梦8的任务模板json

1、从达梦8读取写入到MySQL5.7模板

{
    "job": {
        "setting": {
            "speed": {
                 "channel": 3
            },
            "errorLimit": {
                "record": 0,
                "percentage": 0.02
            }
        },
        "content": [
            {

                "reader": {
                    "name": "rdbmsreader",
                     "parameter": {
                        "column": ["ID","USERNAME","PASSWORD"],
                        "connection": [
                            {
                                "jdbcUrl": ["jdbc:dm://10.252.xx.xxx:15236?schema=SYSDBA"],
                                "table": ["TEST_DATAX"]
                            }
                        ], 
                        "password": "SYSDBA001", 
                        "username": "SYSDBA"
                    }
                },
               "writer": {
                    "name": "mysqlwriter",
                    "parameter": {
                        "print":true,   
                        "column": [
                            "id",
                            "username",
                            "password"
                        ], 
                        "connection": [
                            {
                                "jdbcUrl": "jdbc:mysql://10.252.xxx.xx:30006/test_datax_dm?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai",      
                                "table": ["test_datax"]    
                            }
                        ], 
                        "password": "root", 
                        "username": "root"
                    }
                }
            }
        ]
    }
}

2、从MySQL5.7读取写入到达梦8模板

{
    "job": {
        "setting": {
            "speed": {
                 "channel": 3
            },
            "errorLimit": {
                "record": 0,
                "percentage": 0.02
            }
        },
        "content": [
            {

                "reader": {
                    "name": "mysqlreader",
                    "parameter": {
                        "username": "root",
                        "password": "root",
                        "column": [
                            "id",
                            "username",
                            "password"
                        ],
                        "connection": [
                            {
                                "table": [
                                    "test_datax"    
                                ],
                                "jdbcUrl": [
                                    "jdbc:mysql://10.252.xxx.xx:30006/test_datax_dm?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai"
                                ]
                            }
                        ]
                    }
                },
               "writer": {
                    "name": "rdbmswriter", 
                    "parameter": {
                        "column": ["ID","USERNAME","PASSWORD"], 
                        "connection": [
                            {
                                "jdbcUrl": "jdbc:dm://10.252.xx.xxx:15236?schema=SYSDBA", 
                                "table": ["TEST_DATAX"]
                            }
                        ], 
                        "password": "SYSDBA001", 
                        "username": "SYSDBA",
                        "preSql": [], 
                        "session": []
                    }
                }
            }
        ]
    }
}

你可能感兴趣的:(大数据,笔记,数据库,DataX,数据同步,ETL)