Results 1 to 2 of 2
  1. #1
    mathidioticz is offline Member
    Join Date
    Jan 2012
    Posts
    48
    Rep Power
    0

    Default 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:
    Java 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)

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default Re: General Error- What does that mean?

    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.

Similar Threads

  1. A general question
    By wizar in forum New To Java
    Replies: 6
    Last Post: 01-15-2011, 10:13 PM
  2. General Java Help
    By ST34LTH in forum New To Java
    Replies: 2
    Last Post: 11-07-2010, 03:57 PM
  3. general help.
    By socboy6579 in forum New To Java
    Replies: 1
    Last Post: 10-24-2010, 10:41 PM
  4. general help.
    By socboy6579 in forum New To Java
    Replies: 1
    Last Post: 10-24-2010, 09:20 PM
  5. General Discussion on Abstract
    By sanjeevtarar in forum Advanced Java
    Replies: 15
    Last Post: 05-06-2008, 06:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •