Results 1 to 2 of 2
  1. #1
    sasi.tati is offline Member
    Join Date
    Jul 2010
    Rep Power

    Default How to print PreparedStatment object in console

    Dear All

    i am using PreparedStatment for inserting data into a table, but in my local system it is working fine, but after deploying in JBoss it is throwing "invalid column type" error. In order to check i tried to print in the JBoss console but i am unable print in the console, kindly help me regarding this.
    The code which i used is:
    PreparedStatement stmtPrep = conn.prepareStatement(sql);
    try {
    stmtPrep.setObject(1, number);
    stmtPrep.setObject(2, (String) passList.get("PlantCode"));
    stmtPrep.setObject(2, (String) passList.get("PlantExt"));
    stmtPrep.setObject(3, ls_per_ord_qty_ind);
    stmtPrep.setObject(4, ls_price);
    stmtPrep.setObject(5, (String) inList.get(4));
    stmtPrep.setObject(6, (String) List.get("txtStoreLoc"));
    stmtPrep.setObject(7, (String) List.get(1));
    h = (String) List.get("Price");
    float unit = Float.valueOf(h.trim()).floatValue();
    stmtPrep.setFloat(8, unit);
    System.out.println(">>>Query is>>>>>"+stmtPrep);
    Can any one guide me how to print in JBoss console this stmtPrep and check all the values that i am passing r correct r not.
    but it is throwing like this:
    15:16:30,686 INFO [STDOUT] >>>Query is>>>>>org.jboss.resource.adapter.jdbc.Wrap

  2. #2
    r00tb33r is offline Member
    Join Date
    Jun 2010
    Rep Power


    I'm working on a similar thing, there is no method that returns the SQL statement in any form.
    The only (obvious) solution I came up with is forming the string statement yourself and printing it to the console (of choice).
    Obviously you probably wouldn't want to print statements that contain BLOBs, best to leave those fields as "?" when printing.

Similar Threads

  1. Replies: 2
    Last Post: 06-22-2010, 05:29 AM
  2. Console Object
    By newbie123 in forum New To Java
    Replies: 2
    Last Post: 11-10-2009, 03:33 AM
  3. How to print an object-filled array?
    By Verna_Venisa in forum New To Java
    Replies: 1
    Last Post: 10-20-2008, 09:09 PM
  4. Print the text file and print preview them
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-23-2008, 12:04 AM
  5. [SOLVED] ReadLine(String fmt,Object... args) of Console class
    By Pooja Deshpande in forum New To Java
    Replies: 4
    Last Post: 04-25-2008, 06:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts