Question

J'ai une requête SQL très simple et quand je tente d'exécuter, j'obtiens l'erreur suivante

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 ai configuré weblogic datatsource et en utilisant le même

Oracle version: 10g

Version weblogic: 9.2

query:     SELECT tbl_a. * FROM tbl_a OÙ ID1 = '' et ID2 = ''

Était-ce utile?

La solution

Utilisez-vous un PreparedStatement? Essayez de spécifier les valeurs NULL pour chaque colonne au lieu de la chaîne vide, par exemple:.

    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();
    }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top