1

EDIT: I am using Oracle

I am Writing a dynamic query using PreparedStatement which goes something like this

String query="UPDATE <tablename> SET 
        column1=?,column2=?,.....,coulmn7=? WHERE "
        + "column5=TO_DATE(?,'DD/MM/YYYY') AND "
        + "column6=? AND "
        ....
        + "column7=?";

PreparedStatement prest2=con2.PrepareThisStatement(query);

while(true){

   //loop through and bind values
   if(end of list) break;
}
 prest2.executeUpdate(query);

I need to keep the track of the queries that get fired at the database and log them in a table.

But I cannot get the entire query when using the PreparedStatement, nor can I store the values in a separate field. Is there a way to get the final query that was fired at the database.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Sangeet Menon
  • 9,555
  • 8
  • 40
  • 58

1 Answers1

0

You Can, using 1prest2.toString();

TheWhiteRabbit
  • 15,480
  • 4
  • 33
  • 57