javasqloracle-databasebea

ORA-0 [BEA][Oracle JDBC Driver] Unhandled sql type


I have a very simple sql query and when i try to execute, i get following error

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
            ...

I have configured weblogic datatsource and using the same

Oracle version : 10g

weblogic version: 9.2

query : SELECT tbl_a.* FROM tbl_a WHERE ID1='' AND Id2=''


Solution

  • Are you using a PreparedStatement? Try specifying null values for each column instead of the empty string, e.g.:

        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();
        }