Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: java往数据库中直接存为clob字段时,oracle会报ORA-01704问题:字符串文字过长。 #1030

Open
weihebu opened this issue Apr 26, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@weihebu
Copy link
Contributor

weihebu commented Apr 26, 2024

What happened?

作者你好,就是我在使用addax同步oralce中的数据时,当遇到表中有clob字段并且使用update模式时,clob数据过大就会报连接重置,我觉得可不可以按照以下链接的方式处理一下clob字段,大约每三千个字符长度进行一次截断,然后用to_clob('字符1') || to_clob('字符2') || to_clob('字符3') || to_clob('字符4')拼接回来?附上链接。
https://juejin.cn/post/7019677362035884063

Version

4.1.4

OS Type

centos

Java JDK Version

Oracle JDK 1.8.0

Relevant log output

No response

@weihebu weihebu added the bug Something isn't working label Apr 26, 2024
@wgzhao
Copy link
Owner

wgzhao commented Apr 27, 2024

请贴出完整的运行日志

@weihebu
Copy link
Contributor Author

weihebu commented Apr 29, 2024

datax_blob.txt

@weihebu
Copy link
Contributor Author

weihebu commented Apr 29, 2024

作者你好,已经以附件的形式上传了日志,其中字段“TRIGGER_COND” 是clob字段,长度超过四千的话,就会报这个错误。

wgzhao added a commit that referenced this issue Apr 30, 2024
…Clob Column #1030

ORA-1461 error occurs when executing merge statements with a NCLOB column as a target and a bind variable value which is longer than 4000 bytes:

Only if String length > 4000 bytes.

If instead of MERGE a separate statement is used for INSERT or UPDATE (based on situation) then the error is not reported.
@wgzhao
Copy link
Owner

wgzhao commented Apr 30, 2024

已尝试解决这个问题,其实 java.sql.SQLRecoverableException: Closed Connection 这个报错,还不完全是 clob 的问题,它还和 Java 选择的随机发生器有一定的关系。

你可以尝试下载
addax-rdbms-4.1.5-SNAPSHOT.zip
,修改 zip 后缀为 jar,然后替换 $ADDAX_HOME/lib 下的addax-rdbms-<version>.jar 文件。

@weihebu
Copy link
Contributor Author

weihebu commented Apr 30, 2024

好的,等假期结束,我这边替换上去试下。此外Java 选择的随机发生器是指什么,没看懂。

@weihebu
Copy link
Contributor Author

weihebu commented May 6, 2024

我这边测试了一下,发现只有一条数据的情况下没有报错,但是多条还是会有问题,新的日志附在下面。
datax_blob2.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants