JDBC PreparedStatement compared to the Statement of benefits

Statement object:

For performing simple SQL statements without parameters;

Features:

. A sql statement executes only a single strip;

. B sql statement can only be executed with no parameters;

. C point of view of the operating principle, after receiving the database sql statement sql statement that article needs to be compiled before execution;

D. Comparison with other interfaces, adapted to perform with a single parameter without sql statement, this efficiency is relatively high.

PreparedStatement objects

Pre-compiler to perform with or without IN parameters of the SQL statement;

Features:

. A inherited from the Statement interface (meaning relatively more comprehensive function);

. B precompiled with characteristics;

. C sql statement batch processing;

. D processing sql statement with unknown parameters;

. E having security, which can prevent malicious attacks injection sql statement;

. F in dealing with a single statement, execution efficiency is not fast Statement;

g. improve the readability and maintainability of the program.

Guess you like

Origin www.cnblogs.com/Jansens520/p/11466468.html