6 messages in com.mysql.lists.javaRe: NullPointerException when I execu...
FromSent OnAttachments
Alison, Nathan15 Mar 2001 18:39 
Bruce Scharlau15 Mar 2001 22:53 
Eric Frazier15 Mar 2001 22:56 
Dror Matalon15 Mar 2001 23:03 
Eric Frazier15 Mar 2001 23:05 
Cris Perdue16 Mar 2001 08:47 
Subject:Re: NullPointerException when I execute statements (mm.mysql driver)
From:Dror Matalon (dr@matal.com)
Date:03/15/2001 11:03:40 PM
List:com.mysql.lists.java

I don't think so. From the the man page:

executeUpdate

public int executeUpdate(String sql) throws SQLException

Executes an SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing, such as SQL DDL statements, can be executed.

Parameters: sql - a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing

Returns: either the row count for INSERT, UPDATE or DELETE or 0 for SQL statements that return nothing

Since the only things I can see that could be null are either the sqlStatement or the createCommand, and we know (from the code) that createCommand is not null, I would suspect that sqlStatement is null. Possilby something in the connection didn't go quite right. Should be easy to add in the catch section a line: System.out.println(sqlStatement) and see what he gets.

Dror

On Fri, 16 Mar 2001, Bruce Scharlau wrote:

On Friday 16 March 2001 02:39, you wrote:

Can anyone give me an idea of what's wrong here?

int myInt = sqlStatement.executeUpdate(createCommand);

Nathan,

Why are you trying to produce an int when you execute the update?

leave of the 'int myInt = " Use:

sqlStatement.executeUpdate(createCommand);

and it should run fine.

To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java@lists.mysql.com instead.