Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of reading and writing Oracle NClob

2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to solve the problem of Oracle NClob reading and writing, which is very detailed and has a certain reference value. Friends who are interested must finish it!

In a recent new project, you tried to use NCLOB in the Oracle database to save large xml strings.

In the code automatic generation tool (through the JDBC driver, read the database table structure, automatically generate the corresponding java code, including add, delete, modify, paging query, search according to the primary key and other foreground html/js, background code java), map the NCLOB field to the String type.

Run the code without reporting an error. Use the SQuirreL SQL client to view the data and notice that the data was not saved successfully.

Do a search on the Internet, and some mention additional properties of connecting to the database with SetBigStringTryClob. I always feel so stupid. It is also mentioned to use the setStringForClob method, which is also relatively stupid.

Finally, on the Oracle website, find a better way:

Upgrade the Oracle JDBC driver, directly use the java JDBC standard setString function, save successfully!

Corresponding URL:

Http://docs.oracle.com/cd/E11882_01/java.112/e16548/oralob.htm#JJDBC28534

It says:

In Oracle Database 11g release 2, the setBytes, setBinaryStream, setString, setCharacterStream, and setAsciiStream methods of PreparedStatement are extended to enhance the ability to work with BLOB, CLOB, and NCLOB target columns.

...

The SetBigStringTryClob connection property of Oracle Database 10g Release 1,10.1 is no longer used or needed.

...

-

The above is all the contents of the article "how to solve the Oracle NClob Reading and Writing problem". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report