Suppose you execute a query to delete some rows and you want to know how many rows were deleted. In general, the JDBC API provides two methods (available in the java.sql.Statement interface) to find the number of rows affected by a SQL query: execute() and executeUpdate().
Get the Number of Rows Affected Using the executeUpdate() Method
Using the executeUpdate() method, we can get the number of rows affected:Connection conn = ... get a java.sql.Connection object ...
Also, we may write this as a method:/**
Get the Number of Rows Affected Using the execute() Method
The execute() method executes the given SQL query, which may return multiple results. This method returns a boolean (true/false). The execute() method returns true if the first result is a ResultSet object; it returns false if it is an update count or there are no results.Connection conn = ... get a java.sql.Connection object ...
JDBC Related Interview Questions
|Core Java Interview Questions||JSP Interview Questions|
|Java Servlets Interview Questions||EJB(Enterprise JavaBeans) Interview Questions|
|JSTL(JSP Standard Tag Library) Interview Questions||JNDI (Java Naming and Directory Interface) Interview Questions|
|Java Bean Utils Interview Questions||AWT (Abstract Window Toolkit) Interview Questions|
What Is Jdbc Programming?
Database Metadata, Part 1
Database Metadata, Part 2
Exploring Driver Property Information
Rowset Metadata A
Web Access To Metadata,part 1
Web Access To Metadata, Part 2
Rdf And Jdbc Metadata
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.