DIFFERENCE BETWEEN executeQuery( ), executeUpdate( ) AND execute( )

If you have any queries please leave a message here
Your Message
×


ResultSet executeQuery(String sql) throws SQLException - This method is used for SQL statements which retrieve some data from the database. For example - SELECT statement. This method is meant to be used for select queries which fetch some data from the database. This method returns one java.sql.ResultSet object which contains the data returned by the query.

int executeUpdate(String sql) throws SQLException - This method is used for SQL statements which update the database in some way. For example - INSERT, UPDATE and DELETE statements. All these statements are DML(Data Manipulation Language) statements. This method can also be used for DDL(Data Definition Language) statements which return nothing. For example CREATE and ALTER statements. This method returns an int value which represents the number of rows affected by the query. This value will be 0 for the statements which return nothing.

boolean execute(String sql) throws SQLException - This method can be used for all types of SQL statements. If you don’t know which method to use for your SQL statements, then this method can be the best option. This method returns a boolean value. TRUE indicates that statement has returned a ResultSet object and FALSE indicates that statement has returned an int value or returned nothing.




SET ENVIRONMENT VARIABLES IN WINDOWS

Right click on ComputerPropertiesAdvanced system settings

In Advanced tab click on Environment Variables... button

Set the environment variables listed below :

VariableValue
JAVA_HOMEC:\Program Files\Java\jdk1.8.0_112\bin
JDK_HOME%JAVA_HOME%
JRE_HOMEC:\Program Files\Java\jre1.8.0_112\bin
CLASSPATH%JAVA_HOME%
PATHC:\Program Files\Java\jdk1.8.0_112\bin;C:\Program Files\Java\jre1.8.0_112\bin




RELATED TOPIC



ABOUT US

QuestionSolves.com is an educational website that helps worldwide students in solving computer education related queries.

Also, different software like Visual Studio, SQL Server, Oracle etc. are available to download in different versions.

Moreover, QuestionSolves.com provides solutions to your questions and assignments also.


MORE TOPIC


Windows Command

UNIX Command

IGNOU Assignment Solution

IGNOU Question Paper Solution

Solutions of Different Questions


WHAT WE DO


Website Devlopment

Training

Home Learning

Provide BCA, MCA Projects

Provide Assignment & Question Paper Solution


CONTACT US


Follow Us