1 Reply Latest reply on Mar 18, 2009 11:33 PM by Vishal Mehta

    Insert CLOB or BLOB in oracle 10g  with JNDI ,giving ClassCa

    rajesh nich Newbie

      Hi

      I am getting an ClassCastException,while inserting an String(a XML) as a CLOB to oracle10g database using Jboss server.
      I am using a JNDI ,and getting an connection,trying to use psNew.setStringForClob method of OraclePreparedStatement giving an error as follows :
      Connection name ---> 2org.jboss.resource.adapter.jdbc.WrappedConnection
      java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrappedPreparedStatement cannot be cast to oracle.jdbc.OraclePreparedStatement

      Code is :
      ------------------
      con = getConnection();

      if (con != null) {
      System.out.println(" Connection name ---> 2" + con.getClass().getName());
      String query = "INSERT INTO HR_USERS VALUES (?, ?, ?)";
      psNew = (OraclePreparedStatement)con.prepareStatement(query);

      psNew.setString(1,"John" );
      psNew.setString(2, transDto.getAgentVersion());
      psNew.setStringForClob(3, dto.getIncomingXml());
      psNew.executeUpdate();

      please suggest the error or guide for a new method to insert CLOB to oracle 10g using jndi (Jboss server)