以前我用的SQL Server 驱动是 com.microsoft.jdbc.sqlserver.SQLServerDriver
现在公司用的SQL Server 驱动是 net.sourceforge.jtds.jdbc.Driver当我第一次进入一个查询方法可以把数据给读取出来,第二次进入另一个方法出现
我的statement对象不是null值啊.?
java.sql.SQLException: The SQL statement must not be null or empty.  
net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1245)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100)
org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57)
$java.sql.Wrapper$$EnhancerByProxool$$bb6beb70.executeQuery()
com.landray.kmss.km.coustomtable.dao.jdbc.KmCustbDataOperaDaoImp.findByPrimaryKey(KmCustbDataOperaDaoImp.java:191)
com.landray.kmss.km.coustomtable.service.spring.KmCustbDataOperaServiceImp.findByPrimaryKey(KmCustbDataOperaServiceImp.java:28)
com.landray.kmss.km.coustomtable.actions.KmCustbDataOperaAction.view(KmCustbDataOperaAction.java:148)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
.....
        
        现在晕死了...能给有用意见的都有分,不够我加分

解决方案 »

  1.   

    说的应该是你的sql语句为空吧
      

  2.   

    The SQL statement must not be null or empty...
      

  3.   

    在executeQuery之前,先System.out.printf 你的sql,估计是空串?
      

  4.   

    控制台上打下你的各个参数和SQL语句看看
      

  5.   

    我现在发现高手很多啊!连自己错误信息都不会看?更不用说调试!好DOWN!学JAVA连错误都不会看就学的太高手拉!
      

  6.   

    把出错代码贴出来估计是获取statement 为空
    debug吧
      

  7.   

    最天晚上11点终于找到了,是sql语句的String为null,与驱动没有关系
    哎,公司项目比较大我的电脑配置给不上,所以不能在Eclipse里启动Tomcat,debug不了
    只能通过logger.debug()的方式调试...,晕死,晚上回去散分....谢谢各位了顺便问一下 SQL Server这两个驱动有什么关系或区别
     com.microsoft.jdbc.sqlserver.SQLServerDriver 
     net.sourceforge.jtds.jdbc.Driver 
      

  8.   

    刚出道,比较菜..外部启动也有debug模式????