0 Replies Latest reply on Oct 23, 2001 12:15 AM by Nguyen Tuan Khang

    PreparedStatement error

    Nguyen Tuan Khang Newbie

      Hi

      I have a suprised error with Preparedstatement in JBoss with oracle 8i.
      --------------------
      s = "select username from user where username=?";
      PreparedStatement stmt = con.prepareStatement(s);
      stmt.clearParameters ();
      stmt.setString(1, "demo");
      result = stms.execute();
      --------------------
      Assume that the database already has username demo. But the above code return null

      ------------------------
      Then I used:
      s = "select username from user where username='demo'";
      Statement stmt= con.createStatement(s);
      result = stmt.execute(s);
      ------------------------
      that works.
      Suprisingly, when I changed back to the first solution It works too even when I restart JBOss server. But if I restart PC contains JBoss and database server. Everything is back.

      Is there anybody knows this error???
      regards,
      Khang