General Error- What does that mean?
Hi, when trying to run my entity class, this "General error" occur and i do not really know what does that mean and how can i solve it.
Here is the code where the error lies:
Code:
public boolean createGameQuestion() {
boolean success = false;
ResultSet rs = null;
DBController db = new DBController();
String dbQuery;
db.setUp("CFDatabase");
if ( g_question == " ") {
dbQuery = "INSERT INTO GameQuestion (g_image1,";
dbQuery = dbQuery + "g_image2, g_image3, g_imageDescription1, g_imageDescription2, g_imageDescription3)";
dbQuery = dbQuery + "VALUES(\'" + g_image1 + "','" + g_image2 + "', '" + g_image3 + "', '";
dbQuery = dbQuery + g_imageDescription1 + "', '" + g_imageDescription2 + "', '" + g_imageDescription3 + "')";
}
else {
dbQuery = "INSERT INTO GameQuestion (g_question, g_image1,";
dbQuery = dbQuery + "g_image2, g_image3, g_imageDescription1, g_imageDescription2, g_imageDescription3)";
dbQuery = dbQuery + "VALUES (\'" + g_question + "', '";
dbQuery = dbQuery + g_image1 + "', '" + g_image2 + "', '" + g_image3 + "', '";
dbQuery = dbQuery + g_imageDescription1 + "', '" + g_imageDescription2 + "', '" + g_imageDescription3 + "')";
}
rs = db.updateRequestKey(dbQuery);
try{
if (rs.next()){
// this will return the ID which is a auto number primary key
g_question = rs.getString(1);
success = true;
}
}
catch (Exception e) {
e.printStackTrace();
}
db.terminate();
return success;
}
And here is what the console say about the error:
connection is jdbc:odbc:CFDatabase
DB Query: INSERT INTO GameQuestion (g_question, g_image1,g_image2, g_image3, g_imageDescription1, g_imageDescription2, g_imageDescription3)VALUES ('null', '/HealthOK/ui/images/wine1.png', '/HealthOK/ui/images/wine2.png', '/HealthOK/ui/images/wine3.png', '1 large wine (250ml)', '1 bottle of wine', '1 bottle of whisky')
java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unkn own Source)
at OOPJ.database.DBController.updateRequestKey(DBCont roller.java:84)
at HealthOK.entity.gameQuestion.createGameQuestion(ga meQuestion.java:183)
at HealthOK.entity.gameQuestion.main(gameQuestion.jav a:22)
java.lang.NullPointerException
at HealthOK.entity.gameQuestion.createGameQuestion(ga meQuestion.java:185)
at HealthOK.entity.gameQuestion.main(gameQuestion.jav a:22)
Re: General Error- What does that mean?
Quote:
java.lang.NullPointerException
at HealthOK.entity.gameQuestion.createGameQuestion(ga meQuestion.java:185)
The trace stack shows you have a null variable being used at line 185. Look at that line and see what variable is null.