1. 程式人生 > >JDBC中輸出PreparedStatement物件中的SQL語句的方法

JDBC中輸出PreparedStatement物件中的SQL語句的方法

ResultSet rs = statement.executeQuery();
	if (statement instanceof com.mysql.jdbc.PreparedStatement) {
		com.mysql.jdbc.PreparedStatement msqlPstmt = (com.mysql.jdbc.PreparedStatement)statement;
		String sqla = msqlPstmt.toString();
		System.out.println(sqla);
	}