在一个网页的系统,数据录入的时候出现: PreparedStatementCallback; bad SQL grammar 30
就是纯粹的数据逐项录入,最后一点保存就出现这个错误提示,我想知道这是我这台录入电脑的问题,还是数据库的问题,还是这个系统的问题呢?要怎么解决呢? 展开
I have an update method to update the content of a table based on a specific field and I am getting following exception.
解决方法:
Code is :
public void updateTaxoActive(String oldDesc, String description) {
Logger.getLogger(TypeCategoryJDBCTemplate.class.getName()).log(Level.INFO, "old taxonomy code is {0} new description is {1}", new Object[]{oldDesc, description}); String sql = "update product.typecategory set taxonomydescription = ? where taxonomydescription = ?";
jdbcTemplateObject.update(sql, new Object[]{description,oldDesc},new TypeCategoryMapper());
g.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select top ? * from (select top ? song.singer_id,song.song_id,song.song_name,song.title_url,song.mv_url,singer.
singer_name from webdb_prod_song as song,webdb_prod_singer as singer where song.singer_id=singer.singer_id) as music where music.singer_id not in (select top ? song.singer_id from webdb_prod_song as song,webdb_prod_singer as singer where song.
singer_id=singer.singer_id)]; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: '@P0'
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.
springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76).
因为这个是单位扶贫办的系统,服务器不在本地,我只是在线录入数据,所以想问一下:到底是我本地的问题,还是远程数据库也就是这个在线录入系统的问题?
这个两种情况都有可能出现,如果人家在你录入数据的时候 明确的告知了所有的数据类型 那么可能问题就是出现在录入时 没有满足它所需要的要求
也有可能是 它在处理的时候 考虑的不太周全 导致数据的不统一
没有看到具体的 所以无法确定