It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes executeUpdate Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "executeUpdate Error" Watch "executeUpdate Error" New topic

executeUpdate Error

Kassi Hill

Joined: Sep 29, 2003
Posts: 24
I am trying to run an SQL update statement and I am passing the SQL as a string into a method. I am getting the following error message:
"": Error #: 354 : incompatible types; found: int, required: java.sql.ResultSet at line 58, column 30"
I do not under stand the message, Your help would be greatly appreciated!!
This is the code:
public void runUpdateQuery(String sql){
//This method is called from the Business DataAccess Classes each time an
//Update needs to be made to the DataBase such as Insert, Delete statements
conCounter ++;
openConnection();//Open the Connection
stmt = conn.createStatement();//Create Statement Object
rs = stmt.executeUpdate(sql
closeConnection();//Close Connection
}catch(SQLException sqle) {
System.err.println("SQL NOT Executed: " + sqle);
}//end try/catch
}//end runUpdateQuery
Bill Wang
Ranch Hand

Joined: Jun 28, 2001
Posts: 31
check your sql statement to make sure that the fields that you are using have the same types as your db table fields.

SCJP<br />SCWCD<br />SCEA Part I
Kassi Hill

Joined: Sep 29, 2003
Posts: 24
I am getting this error when I try compiling the program. I have not yet been able to send an actual statement yet because I have not been able to successfully compile the program.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

executeUpdate() should return an int - the number of rows successfully updated. It is used for insert, update and delete statements. executeQuery() is the one that returns a result set. It is used for select statements.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: executeUpdate Error
It's not a secret anymore!