hi everyone. can any of you guide me asto how to avoid null pointer exception in the result set variable.i am using this function to get all data in mysql table in hashtable. how to i take the scenario if there was no data in the table at time of execution. ie. the first time the programe was executed with nothing in database. since the table has nothing and resultSet is is pointed to null gives null pointer exception. how can i deal with that. thanks in advance
kesh.
static void readDatabase() throws Exception{
try{
// This will load the MySQL driver, each DB has its own driver
Class.forName("com.mysql.jdbc.Driver");
// Setup the connection with the DB
connect = DriverManager
.getConnection("jdbc:mysql://localhost/mydatabase?"
+ "user=sqldata&password=sqldatapw");
resultSet = statement
.executeQuery("select * from MYDATABASE.CUSTOMER");
CusList = (CustomerList)resultSet;
System.out.println("files reloaded.");
}
catch (Exception e) {
throw e;
} finally {
close();
}
}