Has the Oracle, MySQL, used three kinds of data sources;
How to get to the SQL statement from a PreparedStatement object!!!!!!
//execute SQL query main method
Public Boolean submit (String SQL Object... ¶s) {
The Connection conn=null;
PreparedStatement PSTMT=null;
Try {
Conn=DBConnectionPool. GetConnection (dbenum);
//define a PreparedStatement object
PSTMT=conn. PrepareStatement (SQL, the ResultSet. TYPE_FORWARD_ONLY, ResultSet. CONCUR_READ_ONLY);
//the result set an article to get the data of several
PSTMT. SetFetchSize (SysConst. FETCHCOUNT);
If (¶s!=null) {
for (int i=0; I & lt; ¶s. Length; I++) {
The Object para=¶s [I];
If (para!=null & & Para. GetClass () equals (Java. Util. Date. Class)) {
The Date d=(Date) para;
PSTMT. SetTimestamp (I + 1, new Timestamp (d.g etTime ()));
} else {
PSTMT. SetObject (I + 1, para);
}
}
}
//output edit good SQL statements, facilitate survey questions
Logger. The info (" SQL statements - & gt;" + SchemaUtil. GetSQLString (PSTMT));
} the catch (Exception e) {
Process exception logger. The error (" query ", e);
return false;
} the finally {
If (PSTMT!=null)
Try {
PSTMT. Close ();
} the catch (SQLException e) {
Logger. The error (" connection closed exception ", e);
}
If (conn!=null)
Try {
Conn. Close ();
} the catch (SQLException e) {
Logger. The error (" connection closed exception ", e);
}
}
return true;
}
///////////////////////////////////////////////////////////////////////////////////
Public class SchemaUtil {
Public static String getSQLString PreparedStatement (pre) {
//print the SQL statement
}
}