Jarrod Hermer on Thu, 20 Feb 2003 16:14:47 +0200 (SAST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Linux dev] Java NullPointerException


Hi all,

I have a strange bug which I can't seem to pin down. Using Java 1.4.1 I
have a simple app that polls a MS SQL server for data using a stored
procedure here is my code:

------------------------------------------------------------------------
----

ResultSet rs = null;

try
{
	CallableStatement cs = conn.prepareCall("{call
GetUserByName(?)}");
	cs.setString(1, name);
	rs = cs.executeQuery();
}
catch(SQLException ex)
{
	System.out.println("ERROR getting user");
	System.out.println(ex.getMessage());
}

while(rs.next())
{
	// Do Stuff
}
rs.close();

------------------------------------------------------------------------
----

On my development machine it functions without any problems. However on
my production machine which I am convinced is identical the program
crashes with a Java.NullPointerException error.

Any ideas?

Regards,
Jarrod