我尝试了几个例子,但似乎都没有.这是我上次尝试的代码
import oracle.jdbc.driver.OracleDriver;
PreparedStatement prs = null;
ResultSet rrs = null;
Class stmt1 = null;
java.lang.reflect.Field mem = null;
requestSQL = "Select FIPS_STATE_CD_TXT, FIPS_COUNTY_CD_TXT from MSTR_FIPS_COUNTY where STATE_ID = ? " + " and COUNTY_TXT = ?";
prs.setString(1, vPropertyState);
prs.setString(2, vPropertyCounty);
System.out.println(prs.toString()); //JRN
Class stmt1 = prs.getClass();
java.lang.reflect.Field mem = stmt1.getField("sql");
String value= (String)mem.get(prs);
rrs = prs.executeQuery();
我在这上面得到一个错误:
Exception trying to make a TAF call
java.lang.NoSuchFieldException: sql
at java.lang.Class.getField(Class.java:1520)
我甚至试过在JavaWorld中使用这个例子,但我的编译器似乎没有识别DebugLevel和StatementFactory.我应该为此下载一个特殊的包吗?
http://www.javaworld.com/javaworld/jw-01-2002/jw-0125-overpower.html?page=3
我使用的是Java 1.6和Oracle 11g.我也在寻找快速修复,而不是安装log4jdbc或p6sy