5 Replies Latest reply on Dec 22, 2008 8:50 AM by 667847

    Is there a way to tell what is actually being passed to DB from PreparedSta

    800402

      Is there a way to tell what is actually being passed to DB from PreparedStatement? What I mean by that is that I have a PreparedStatement that is a simple

      prepstmt = connection.prepareStatement("Insert into table (col1, col2, col3, .... colx) values (?,?,?....?)");

      (there are x ?s)
      I precompile this, and later, when there is a connection I call set all the variables

      prepstmt.setInt(1, someint); prepstmt.setString(2, "\\'" + somestring + "\\'"); etc... prepstmt.executeUpdate();

      I get back an exception thrown by Oracle complaining that one of my values is too large for the column (but doesn't say what column/value).
      So I made a string that contains what ought to be the same query

      String debug = "Insert into table (col1, col2, col3, .... colx) values (someint,'somestring',etc....someotherint)"; System.out.println(debug);

      I give the printed out line directly to Oracle through SQLScratchpad and it works just fine in there and I can confirm the row has been inserted. Nothing is too big.
      Is there a way to look at what the PreparedStatement actually has as values in there? I found I could look at the original statement (the one with the ?s) if I expand the prepstmt object in the debugger's (Eclipse) view, but nothing to show me where the values were filled in.

      Thanks for any help you can give me.