Countermeasures for abnormal type conversion when the clob field is operated in Tomcat using the JNDI (Tomcat connection pool) Method

Source: Internet
Author: User
While (dbset. Next () {clob = (oracleresultset) dbset). getclob (1); clob. putstring (1, questioncontent );

Or

If (RSS. Next () {clob = (clob) RSS. getclob (1); clob. putstring (1, allmobilecode );}

If the connection pool is used for insertion, an error is returned. java. Lang. classcastexception: org. Apache. commons. DBCP. delegatingresultset (type conversion exception)

When you operate in JDBC mode, everything is normal. If you switch to the JNDI mode, Java appears. SQL. clob to Oracle. SQL. an error occurred while converting the clob type. I checked it online for half a day and finally found the following solution, which is very simple:
Delete the Oracle Driver (class12.jar) from the WEB-INF/lib directory of the current project, only put one copy in the common/lib in the Tomcat directory (here we need to leave one copy in Tomcat lib because driverclassname = "oracle. JDBC. driver. oracledriver ", the driver must exist when Tomcat is loaded, or an error will be reported ).

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.