iSeries JDBC Sql语句,带有é&引用;列名中抛出java.sql.SQLException:[SQL0104]

iSeries JDBC Sql语句,带有é&引用;列名中抛出java.sql.SQLException:[SQL0104],java,sql,jdbc,ibm-midrange,Java,Sql,Jdbc,Ibm Midrange,在SQL查询返回的列名中使用字符“é”时遇到问题。运行此查询 SELECT PRCAT as Categorie, PRYEA as Année, PRDSC as Designation from DEMO.PRODUCT 使用IBM工具箱JDBC驱动程序连接到iSeries会产生以下异常: java.sql.SQLException: [SQL0104] Token é was not valid. Valid tokens: , FROM INTO. Cause . . . . . :

在SQL查询返回的列名中使用字符“é”时遇到问题。运行此查询

SELECT PRCAT as Categorie, PRYEA as Année, PRDSC as Designation from DEMO.PRODUCT
使用IBM工具箱JDBC驱动程序连接到iSeries会产生以下异常:

 java.sql.SQLException: [SQL0104] Token é was not valid. Valid tokens: , FROM INTO. Cause . . . . . :   A syntax error was detected at token é.  Token é is not a valid token.  A partial list of valid tokens is , FROM INTO.  This list assumes that the statement is correct up to the token.  The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery  . . . :   Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token é. Correct the statement.  The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause.
    at com.ibm.as400.access.JDError.throwSQLException(JDError.java:650)
    at com.ibm.as400.access.JDError.throwSQLException(JDError.java:621)
    at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1481)
    at com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:185)
    at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1903)
    at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1726)
...

如果引用别名会发生什么

SELECT PRCAT as Categorie, PRYEA as "Année", PRDSC as Designation from DEMO.PRODUCT

为什么你会在Anneée中使用ané,而在catégorie和désignation中不使用ané?好问题。。。我不会说法语。这些是从其他地方传来的,可能是字面上的“在翻译中迷失”。。。但是这些字段可能也会出现同样的问题。为什么不更改此SQL查询?我很抱歉你不得不保留这个,但我想不出任何理由保留这个。。。更不用说一开始写这个的任何理由了。它实际上是自动生成的。。。伊什。说来话长!
SELECT PRCAT as Categorie, PRYEA as "Année", PRDSC as Designation from DEMO.PRODUCT