tags:

views:

365

answers:

1

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=''

+1  A: 

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();
    }
karim79
yes i am using prepared statement.i have too many prepared statement to change, Instead i changed driver type to 'oracle thin' from 'bea Oracle'Thanks for answering
zoli