Results 1 to 2 of 2
- 08-20-2010, 11:16 AM #1
Member
- Join Date
- Jul 2010
- Posts
- 18
- Rep Power
- 0
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
pedPreparedStatement@1056bdd
- 08-21-2010, 06:16 AM #2
Member
- Join Date
- May 2010
- Posts
- 14
- Rep Power
- 0
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
-
Create object of unknown class, based on existing object
By Zack in forum New To JavaReplies: 2Last Post: 06-22-2010, 04:29 AM -
Console Object
By newbie123 in forum New To JavaReplies: 2Last Post: 11-10-2009, 02:33 AM -
How to print an object-filled array?
By Verna_Venisa in forum New To JavaReplies: 1Last Post: 10-20-2008, 08:09 PM -
Print the text file and print preview them
By Java Tip in forum java.awtReplies: 0Last Post: 06-22-2008, 11:04 PM -
[SOLVED] ReadLine(String fmt,Object... args) of Console class
By Pooja Deshpande in forum New To JavaReplies: 4Last Post: 04-25-2008, 05:51 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks