Oracle's VARCHAR2 (4000) can store 2000 characters or 4,000 English characters?
Source: Internet
Author: User
In general, using the Ps.setstring () method is not possible, because the Oracle driver will put a Chinese text in three bytes, plus JDBC itself on the word Fu limit to 2000, that is, 600 words, if the English characters can only to 2000, English in 2 bytes, But without the OCI driver, how can you insert 2000 characters through JDBC? Using PreparedStatement's Setcharacterstream method, reader reader = new StringReader (The long character you need to insert); Ps.setcharacterstream (1,reader, character length); This allows you to insert 2000 Chinese characters into the table if you want to do it in hibernate? I didn't think of it! Do you have a CLOB type? Reader reader = new StringReader (new String (chars)); PreparedStatement PS = conn.preparestatement ("INSERT into Tvar (value) VALUES (?)");
Ps.setcharacterstream (1,reader,chars.length);
Ps.executeupdate ();
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.