"java.sql.SQLException:@P0" 附近有错误
2013-06-06 08:53
375 查看
问题出现: "java.sql.SQLException:@P0" 附近有错误,原因sql 不支持“select top ? from [table_name]” 这种语法
解决之道:
如有预处理的时候:select top %s * from [table_name] where userId<? and userage>?;
解决之道:
解决之道:
sql=“select top %s from [table_name]”; sql=String.format(sql,"20");举一反三:
如有预处理的时候:select top %s * from [table_name] where userId<? and userage>?;
解决之道:
sql = select top %s * from [table_name] where userId<? and userage>?; sql = String.format(sql,20); PrepareStatem pst = con.getPrepareStatement(); pst.setint(1,100); pst.setInt(2,20); 。。。。。。。。。
相关文章推荐
- Exception in thread "main" java.sql.SQLException: Connections could not be acquired from the underly
- java.sql.SQLException: ORA-00904: "PASSWORD": 标识符无效
- java.sql.SQLException: ORA-00904: "HOTELSTOCK_"."": 标识符无效
- java.sql.SQLException: '@P0' 附近有语法错误
- Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Io 异常: The Network Ada
- java.sql.SQLException: '@P0' 附近有语法错误
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: ORA-01555: snapshot too old: rollback segment number 8 with name "_SYSSMU8$" too small :回滚段太小
- java.sql.SQLException: Value'0000-00-00'错误解决方法
- Exception in thread "main" java.sql.SQLException: Access denied for user ''@'localhost' (using passw
- Exception in thread "main" java.sql.SQLException: ORA-00923: FROM keyword not found where expected
- java.sql.SQLException: null, message from server: "Host '192.168.1.101' is not allowed to connect
- java.sql.SQLException: '@P0' 附近有语法错误
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- 错误java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
- java读取数据库中的错误:"Unhandled exception type SQLException"
- Exception in thread "main" java.sql.SQLException: Connections could not be acquired from the underly
- sql查询报java.sql.SQLException: Column 'LC_ID' not found 的错误实际上是mysql在hibernate别名的问题
- eclipse 连接 sqlserver2005错误信息:"java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver"