Free Jobs
Reference




Java Forums: Core Java (15) J2EE (3) EJB (5) Servlet (3) JDBC (6) Hibernate (2) Struts (1) Swing (1) Oracle (7) JSP (4) Other (10)

Topic: what is Statement object and its execute methods in the context of JAVA JDBC

To get the Posted Questions details daily in your mail Click Here

Share this Post on Facebook/Twitter/Orkut Bookmark and Share





User: shruti888 Post Date: 05 Jun 2011 11:09

Introduction:
Statement objects and its execute methods in JDBC are used to fetch data from
database using JDBC and JAVA technology



Main Content:

A statement object in JDBC is used to execute SQL query to fetch data from Data base


There are four types of execute methods of Statement object in JDBC as below:


a)boolean execute (String query)

  The execute method executes a query specified in its parameter.

  It may return one or more result sets.This method has boolean value

  and that is true if the next result from this statement is a result table.

 

b)ResultSet executeQuery(String query) 

  The executeQuery method executes a query specified in its parameter.

  It returns one result set


c)int executeBatch(String query) 

   This methods executes Insert ,update ,delete queries and returns the number of rows affected.


d)int[] executeBatch ()

   This method allows us to send a collection of command to database

    for execution and returns an array of integer with values of array

    indication the no of rows affected of different commands in the batch.

    the counts in the return is in the same order as the statements in the batch.


Conclusion:
Thus we learned four types of execute methods of Statement object in JDBC



About Writer:
Hi I am Java Developer from Bangalore


Writer's Link:

Writer's Email:







Comments:
Post Comment





Similar Articles Top ArticlesLatest Articles Other Articles by this Author







www.freejobsreference.com Copyright © 2009-2011 | All Rights Reserved
All content of this website is protected by copyright laws and should not be reproduced in any form or by any means without written permission
(Best viewed in IE 8.0+ or Firefox 3.0+ at resolution of 1024 * 768 or higher)