Saturday, 1 September 2012

Name the different types of Statements? How we can you use PreparedStatement.


The different types of Statements are

• Regular statement (uses createStatement method)
• prepared statement (uses prepareStatement method) 
• callable statement (uses prepareCall)


PreparedStatement :

• PreparedStatement is derived from the class Statement.

• To execute a Statement object several times a PreparedStatement object is required.

• The PreparedStatement object contains not only a compiled SQL statement, but also a precompiled SQL statement too. 

Code: 

PreparedStatement updateSales =con.prepareStatement("UPDATE account = ? WHERE CON_NAME ?");

No comments:

Post a Comment