当前位置: 代码迷 >> Sql Server >> 是不是查询的语句报错了呢 应改如何改呢
  详细解决方案

是不是查询的语句报错了呢 应改如何改呢

热度:100   发布时间:2016-04-24 09:00:50.0
是不是查询的语句报错了呢 应改怎么改呢
11:53:14,387 ERROR Dispatcher:38 - Exception occurred during processing request: StatementCallback; bad SQL grammar [select a.user_id_,c.resource_name,c.url_, from role_user_ a,role_resource_ b,resource_ c where a.role_id_=b.role_id_ and b.resource_id_=c.id_ and a.user_id_='1']; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from role_user_ a,role_resource_ b,resource_ c where a.role_id_=b.role_id_ and b' at line 1
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [select a.user_id_,c.resource_name,c.url_, from role_user_ a,role_resource_ b,resource_ c where a.role_id_=b.role_id_ and b.resource_id_=c.id_ and a.user_id_='1']; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from role_user_ a,role_resource_ b,resource_ c where a.role_id_=b.role_id_ and b' at line 1
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:237)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:407)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:456)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:464)
at org.springframework.jdbc.core.JdbcTemplate.queryForList(JdbcTemplate.java:497)
at com.minxin.security.dao.UserDao.findResourceListByUserid(UserDao.java:48)
at com.minxin.security.dao.UserDao$$FastClassByCGLIB$$b3e93ab3.invoke(<generated>)




Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from role_user_ a,role_resource_ b,resource_ c where a.role_id_=b.role_id_ and b' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1383)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:441)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:396)
... 92 more






------解决思路----------------------
去掉, 后,  你的sql语句应该沒问题了
  相关解决方案