ORA-0 [BEA] [Oracle JDBC Driver]未处理的sql类型

时间:2009-08-21 12:03:19

标签: java sql oracle bea

我有一个非常简单的SQL查询,当我尝试执行时,我得到以下错误

java.sql.SQLException: [BEA][Oracle JDBCDriver]Unhandled sql type  at
weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)  at
weblogic.jdbc.base.BaseExceptions.getException(Unknown Source)  at
            ...

我已经配置了weblogic数据源并使用相同的

Oracle版本:10g

weblogic版本:9.2

查询:     SELECT tbl_a。* FROM tbl_a WHERE ID1 =''AND Id2 =''

1 个答案:

答案 0 :(得分:1)

您使用的是PreparedStatement吗?尝试为每列而不是空字符串指定空值,例如:

    Connection conn = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      conn = getConnection();
      pstmt = conn.prepareStatement("SELECT tbl_a.* FROM tbl_a WHERE ID1=? AND Id2=?");
      pstmt.setNull(1, java.sql.Types.INTEGER);
      pstmt.setNull(2, java.sql.Types.INTEGER); 
      rs = pstmt.executeQuery();
      while (rs.next()) {
          //capture data from the returned rows
      }
    } catch(Exception e) {
      e.printStackTrace();
    } finally {
      pstmt.close();
      rs.close();
      conn.close();
    }