Column not found caused by mysql alias in SQL, mysqlcolumn
Caused by: java. SQL. SQLException: Column 'btn _ ICON 'not found.
The error message indicates that a field in the table cannot be found, but this field does exist in the table.
This problem is hard for Baidu, because Baidu has problems with fields or SQL writing. But in fact,
This is not a problem with SQL or table fields..
The SQL statement is as follows:
SELECT B.RES_ID, B.RES_NAME, B.RES_TYPE, B.TARGET_RESOURCE, A.BTN_ICON AS RES_ICON, A.BTN_SCRIPT AS RES_SCRIPT ,B.CREATE_TIME FROM tf_b_BUTTON A,tf_b_RES B
I tried to annotate this field, but reported A problem with the. BTN_SCRIPT field,Only the alias fields are used!
The reason is that I upgraded the mysql jar package. Upgrade to the mysql-connector-java-5.1.34.jar because I upgraded tomcat (the jar of old mysql only supports tomcat 7 ).
In addition, my data source configuration is:
Url = "jdbc: mysql: // 130.51.2.24: 3010/zplatdb"
It should be changed:
Url = "jdbc: mysql: // 130.51.2.24: 3010/zplatdb? UseUnicode = true & characterEncoding = UTF-8"
Or change:
Url = "jdbc: mysql: // 130.51.2.24: 3010/zplatdb? CharacterEncoding = UTF-8 & useOldAliasMetadataBehavior = true"
Note: Use & amp; to replace & compliance.
Solve the problem.
Reprinted please indicate the source:
This article is from: [ouyida3 blog]
2015.7.3
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.