空间查询时遇到大的Geometry时,要用Clob做参数的形式进行查询,不然会报字符串太大的异常。

  //获取list(clob做参数) public List findDataByClob(final String str, final String[] clobArgs){final StringBuffer sql = new StringBuffer();sql.append(str);{this.getJdbcTemplate().query(new PreparedStatementCreator() {public PreparedStatement createPreparedStatement(Connection con){//throws SQLException {PreparedStatement ps = null;try{String str = sql.toString();ps=con.prepareStatement(str);for (int i = 0; i < clobArgs.length; i++) {Clob clob=con.createClob();clob.setString(i+1,new String(clobArgs[i]));ps.setClob(i+1,clob);}}catch(Exception e){System.out.println(e.toString());}return ps;}}, new AbstractLobStreamingResultSetExtractor(){@Overrideprotected void streamData(ResultSet rs) throws SQLException,IOException, DataAccessException {ResultSetTrans.resultSetToList(rs,list);}});}catch (Exception ex) {ex.printStackTrace();logger.error(ex.getMessage());}return list;},网站空间,服务器空间,香港服务器租用在乎的是沿途的风景以及看风景的心情,让心灵去旅行!

空间查询时遇到大的Geometry时,要用Clob做参数的形式进行查询,不然会报字符串太大的异常。

相关文章:

你感兴趣的文章:

标签云: