Basic HTML version of Foils prepared May 19 99

Foil 14 PreparedStatement class

From Overview of JDBC: Java Database Connectivity Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. by Nancy McCracken,(Sangetta Aggarwal, Meryem Ispirli, Udayan Parvate, Tom Pulikal, Chao-Wei Ou)


PreparedStatements inherit all functionality of Statements.
It may have an IN parameter, which will be indicated by a "?" in the SQL statement.
Each IN parameter is specified in number order from left to right by a setxxx method. stmt.setString(1, "bill"); ResultSet rs = stmt.executeQuery("select * from tb1 where name = ?");
The setxxx methods will convert parameters to appropriate SQL types, or user may use more general stmt.setObject(1, value, "SQLtype");



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Mon Jul 5 1999