datax web采集oracle数据库,能连接无法使用的问题
链接oracle数据库时,要注意自己数据的连接参数,下边代码中的高亮部分作为参考
{
"job": {
"setting": {
"speed": {
"channel": 3,
"byte": 1048576
},
"errorLimit": {
"record": 0,
"percentage": 0.02
}
},
"content": [
{
"reader": {
"name": "oraclereader",
"parameter": {
"username": "abcd_HN",
"password": "zg101@ny2010",
"column": [
"ZKBH",
"ZKBGRQ"
],
"splitPk": "",
"connection": [
{
"jdbcUrl": [
"jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=129.81.5.16)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=CESHI)(INSTANCE_NAME=ZHONGGUO2)))"
],
"table": [
"ZK_ZBJL"
]
}
]
}
},
"writer": {
"name": "postgresqlwriter",
"parameter": {
"username": "postgres",
"password": "123456",
"column": [
"zkbh",
"zkbgrq"
],
"connection": [
{
"table": [
"public.zk_zbjl_test"
],
"jdbcUrl": "jdbc:postgresql://190.11.1.210:5432/EEEE"
}
]
}
}
}
]
}
}
这是我的数据库连接是的必填的参数:
对应上边代码中的:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=129.81.5.16)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=CESHI)(INSTANCE_NAME=ZHONGGUO2)))
这里要注意,代码中有一个INSTANCE_NAME=ZHONGGUO2,参数,根据数据库的版本不同低版本的可能没有,可以使用
SELECT instance_name FROM V$instance;
SQL语句进行查询。
最后在配置web端数据源的时候也要完整填写jdbcurl,如下图: