0

this might be a simple question but am stuck here. I want to print preparestament to check what string it is passing before execution. Is there any way to print it. Here what I tried till now.

PreparedStatement Pdst1=con.prepareStatement("select distinct fyear from tblparam");
System.out.println(Pdst1.toString());

Here am getting output as oracle.jdbc.driver.OraclePreparedStatementWrapper@c8211c But I want to print statement. Kindly help.

  • 1
    Duplicate of https://stackoverflow.com/q/2382532/3260495 – Robert Hume Jun 30 '18 at 07:42
  • You could search on the database side, though. Just add a comment to the SQL `con.prepareStatement("select distinct fyear /*myQuery1*/ from tblparam") and search the cursor cache 'SELECT * FROM v$sql WHERE sql_text LIKE '%myQuery1%';` – wolφi Jun 30 '18 at 13:54

0 Answers0