很奇怪的现象是:始终说Reader的数据库是 Available jdbcUrl,然而Writer就会报错:[连接数据库失败. 请检查您的 账号、密码、数据库名称、IP、Port或者向 DBA 寻求帮助(注意网络环境).]. - 具体错误信息为:java.sql.SQLException: No suitable driver found for ["jdbc:postgresql://127.0.0.1:5432/XXXXXX"]。
即使我将配置文件中的writer和reader连接信息互换,依然会报writer连接失败,reader连接正常。
分别将两个数据库作为reader 写到streamwriter 也没有问题 能print出结果
说明两个数据库本身没有问题 配置的连接信息也没有问题 那问题出在哪里呢???
-----2017/10/26----
今天又用mysqlwriter测试了,问题依然存在?
配置内容如下
{
"job": {
"content": [
{
"reader": {
"name": "postgresqlreader",
"parameter": {
"column": ["name","disp","data"],
"connection": [
{
"jdbcUrl": ["jdbc:postgresql://139.XXX.XXX.XX:5432/XXXXX"],
"table": ["sys_lic"]
}
],
"password": "XXXXXXX",
"username": "XXXXXX"
}
},
"writer": {
"name": "postgresqlwriter",
"parameter": {
"column": ["name","disp","data"],
"connection": [
{
"jdbcUrl": ["jdbc:postgresql://127.0.0.1:5432/XXXXXX"],
"table": ["sys_lic"]
}
],
"password": "XXXXXX",
"username": "XXXXXXX"
}
}
}
],
"setting": {
"speed": {
"channel": "1"
}
}
}
}
报错信息如下
2017-10-25 12:45:15.502 [main] WARN Engine - prioriy set to 0, because NumberFormatException, the value is: null
2017-10-25 12:45:15.505 [main] INFO PerfTrace - PerfTrace traceId=job_-1, isEnable=false, priority=0
2017-10-25 12:45:15.506 [main] INFO JobContainer - DataX jobContainer starts job.
2017-10-25 12:45:15.516 [main] INFO JobContainer - Set jobId = 0
2017-10-25 12:45:16.049 [job-0] INFO OriginalConfPretreatmentUtil - Available jdbcUrl:jdbc:postgresql://139.XXX.XXX.XX:5432/XXXXXX.
2017-10-25 12:45:16.168 [job-0] INFO OriginalConfPretreatmentUtil - table:[sys_lic] has columns:[name,disp,data].
2017-10-25 12:45:16.301 [job-0] ERROR RetryUtil - Exception when calling callable, 异常Msg:Code:[DBUtilErrorCode-10], Description:[连接数据库失败. 请检查您的 账号、密码、数据库名称、IP、Port或者向 DBA 寻求帮助(注意网络环境).]. - 具体错误信息为:java.sql.SQLException: No suitable driver found for ["jdbc:postgresql://127.0.0.1:5432/XXXXXX"]
com.alibaba.datax.common.exception.DataXException: Code:[DBUtilErrorCode-10], Description:[连接数据库失败. 请检查您的 账号、密码、数据库名称、IP、Port或者向 DBA 寻求帮助(注意网络环境).]. - 具体错误信息为:java.sql.SQLException: No suitable driver found for ["jdbc:postgresql://127.0.0.1:5432/XXXXXX"]
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.asConnException(RdbmsException.java:36) ~[plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.util.DBUtil.connect(DBUtil.java:394) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.util.DBUtil.connect(DBUtil.java:384) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.util.DBUtil.access$000(DBUtil.java:22) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.util.DBUtil$3.call(DBUtil.java:322) ~[plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.util.DBUtil$3.call(DBUtil.java:319) ~[plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.common.util.RetryUtil$Retry.call(RetryUtil.java:164) ~[datax-common-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.common.util.RetryUtil$Retry.doRetry(RetryUtil.java:111) ~[datax-common-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.common.util.RetryUtil.executeWithRetry(RetryUtil.java:30) [datax-common-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.util.DBUtil.getConnection(DBUtil.java:319) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.util.DBUtil.getConnection(DBUtil.java:303) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.util.JdbcConnectionFactory.getConnecttion(JdbcConnectionFactory.java:27) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.writer.util.OriginalConfPretreatmentUtil.dealColumnConf(OriginalConfPretreatmentUtil.java:105) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.writer.util.OriginalConfPretreatmentUtil.dealColumnConf(OriginalConfPretreatmentUtil.java:140) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.writer.util.OriginalConfPretreatmentUtil.doPretreatment(OriginalConfPretreatmentUtil.java:35) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.rdbms.writer.CommonRdbmsWriter$Job.init(CommonRdbmsWriter.java:41) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.plugin.writer.postgresqlwriter.PostgresqlWriter$Job.init(PostgresqlWriter.java:33) [postgresqlwriter-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.core.job.JobContainer.initJobWriter(JobContainer.java:704) [datax-core-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.core.job.JobContainer.init(JobContainer.java:304) [datax-core-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.core.job.JobContainer.start(JobContainer.java:113) [datax-core-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.core.Engine.start(Engine.java:92) [datax-core-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.core.Engine.entry(Engine.java:171) [datax-core-0.0.1-SNAPSHOT.jar:na]
at com.alibaba.datax.core.Engine.main(Engine.java:204) [datax-core-0.0.1-SNAPSHOT.jar:na]
老哥,我也是writer 数据库连接失败,reader数据库连接正常,mysql的也开启了远程访问权限什么的,不知道什么原因导致的,你最后问题解决了嘛
沃特么的服了.. 我要是这么写吧报错 :java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
"connection": [
{
"jdbcUrl": "jdbc:mysql://127.0.0.1:3306/autoee_v3",
"table": [
"ac_form_config_copy"
]
}
]
我要是这么写吧:就报java.sql.SQLException: No suitable driver found for
"connection": [
{
"jdbcUrl": ["jdbc:mysql://127.0.0.1:3306/autoee_v3"],
"table": [
"ac_form_config_copy"
]
}
]
一脸蒙逼状....
数据库迁移教程,参考:https://yq.aliyun.com/articles/709185
我也遇到同样的问题,解决方法是:根据数据库版本,更改plugin文件下相应的驱动包;
注意:读写插件文件下都要根据具体数据库修改。
我也遇到同样的问题,解决方法是:
mysqlwriter中的jdbcUrl不能使用[]中括号括起来,应该是只能有一个写入的库
可以参考官网的例子
https://github.com/alibaba/DataX/blob/master/mysqlwriter/doc/mysqlwriter.md
具体写法如下:
"writer": {
"name": "mysqlwriter",
"parameter": {
"writeMode": "insert",
"username": "root",
"password": "root",
"column": [
"id","moduleid"
],
"connection": [
{
"jdbcUrl": "jdbc:mysql://127.0.0.1:3306/autoee_v3",
"table": [
"ac_form_config_copy"
]
}
]
}
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。