sql = SELECT  fs_chain_store.customer_no,  
           fs_customer.customer_name,     
           sum(pos_store_daily_sale.sale_num),  
           sum(pos_store_daily_sale.sale_money),  
           sum(pos_store_daily_sale.finally_money),  
           sum(pos_store_daily_sale.cost_money), 
           round(sum(isnull(pos_store_daily_sale.finally_money,0)-isnull(pos_store_daily_sale.cost_money,0)),2),
           0.0,
           round(sum(isnull(pos_store_daily_sale.finally_money,0)-isnull(pos_store_daily_sale.cost_money,0)),2)
    FROM   fs_chain_store,   
           fs_customer, 
           pos_store_daily_sale 
    WHERE ( fs_chain_store.customer_no = fs_customer.customer_no ) and 
          ( fs_chain_store.store_no = pos_store_daily_sale.store_no )          
  GROUP BY fs_chain_store.customer_no,
            fs_customer.customer_name  
   ORDER BY  fs_chain_store.customer_no ASC     st = context.getConnection().createStatement();
datars = st.executeQuery(sql);不是每次都返回错误 java.sql.sqlexception :JZOr2:该查询无结果集 
偶尔会有这个错误
如果我把 group by去掉,也是没有问题的
我估计是jconnet2的问题,不知道有没有高手遇到过这个问题,不吝赐教

解决方案 »

  1.   

    我也考虑过使用过存储过程 ,但是不到最后我觉得还是不用的好,否则数据库端会有很多类似的存储过程,别人会小看java的能力
      

  2.   

    在java层面解决可能是最好的,希望大家共同解决一下
      

  3.   

    这估计是 jdbc connection 与数据库通信时的有效等待时间问题,没返回结果时说明已经超时,偶尔发生说明数据库由于负载过重或其他原因导致性能已经下降。
    建议先优化数据库性能,不行再延长等待时间(maxWait="5000")。
    欢迎交流:bbs.htok.net
      

  4.   

    st  = context.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    加上参数试试
      

  5.   

    ^_^,解决问题了,是我的sql语句写的在 java环境下有些问题,谢谢大家参与