Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法使用PreparedStatement或其他实用程序对 SELECT 语句的字段进行参数化?
PreparedStatement
我的意思是:
SELECT ?, ? FROM MY_TABLE WHERE ? = ?
不,JDBC 不允许您这样做。参数背后的想法是加快执行速度并避免 SQL 插入;参数化您选择的列对这两个目标都没有帮助。
尝试以下
http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html