本文介绍了将LIKE与ojdbc7.jar一起使用时出现SQLSyntaxErrorException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有以下声明: PreparedStatement prpStat = conn .prepareStatement("SELECT * FROM natperson WHERE name LIKE ?"); prpStat.setString(1, "A"); ParameterMetaData pmd = prpStat.getParameterMetaData(); ResultSet rs = prpStat.executeQuery();当我执行 prpStat.getParameterMetaData时,我得到以下内容( ); 使用ojdbc7.jar的方法。使用ojdbc6时不会抛出异常。and i get the following excepting when i execute the the prpStat.getParameterMetaData(); method with ojdbc7.jar. The exception is not thrown when using ojdbc6.java.sql.SQLSyntaxErrorException: ORA-00904: "NAMEIKE": ungültiger Bezeichner at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:392) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:385) at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:938) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249) at oracle.jdbc.driver.T4C8Odscrarr.doODNY(T4C8Odscrarr.java:96) at oracle.jdbc.driver.T4CPreparedStatement.doDescribe(T4CPreparedStatement.java:719) at oracle.jdbc.driver.OracleStatement.describe(OracleStatement.java:4223) at oracle.jdbc.driver.OracleResultSetMetaData.<init>(OracleResultSetMetaData.java:52) at oracle.jdbc.driver.OracleStatement.getResultSetMetaData(OracleStatement.java:4206) at oracle.jdbc.driver.OraclePreparedStatement.getMetaData(OraclePreparedStatement.java:4603) at oracle.jdbc.driver.OraclePreparedStatementWrapper.getMetaData(OraclePreparedStatementWrapper.java:1510) at oracle.jdbc.driver.OracleParameterMetaData.getParameterMetaData(OracleParameterMetaData.java:70) at oracle.jdbc.driver.OraclePreparedStatement.getParameterMetaData(OraclePreparedStatement.java:11621) at oracle.jdbc.driver.OraclePreparedStatementWrapper.getParameterMetaData(OraclePreparedStatementWrapper.java:1552) at com.agfa.jdbc.test.JDBCTester.main(JDBCTester.java:45)任何想法如何解决这个问题?Any ideas how to solve this?推荐答案 Oracle Bug解决LIKE运算符在解析器中导致问题的问题: 错误18590786An Oracle Bug addresses the issue where the LIKE operator causes a problem in the parser:Bug 18590786此错误也在类似的Oracle Bug中引用: 错误18644587:ORACLEPAR AMETERMETADATAPARSER生成一个不合适的联盟声明This bug was also referenced in a similar Oracle Bug:Bug 18644587 : ORACLEPARAMETERMETADATAPARSER GENERATES BAD STATEMENT FOR A UNION尚不清楚该修复程序是否一般可用。It is not clear whether the fix is generally available yet. 这篇关于将LIKE与ojdbc7.jar一起使用时出现SQLSyntaxErrorException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-25 06:16