We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › mysql class | java.lang.NullPointerException
Page Index Toggle Pages: 1
mysql class | java.lang.NullPointerException (Read 471 times)
mysql class | java.lang.NullPointerException
Mar 28th, 2007, 3:13pm
 
hi folks,
i am trying to get into processing, buts it gets tricky sometime.
Does someone maybe know what is wrong with the class, or with PApplet?
i always get this java.lang.NullPointerException:

java.lang.NullPointerException
at processing.core.PApplet.registerNoArgs(PApplet.java:758)
at processing.core.PApplet.registerDispose(PApplet.java:749)
at de.bezier.mysql.MySQL.<init>(MySQL.java:83)


THIS IS THE CLASS:

class MysqlAnfrage
{
 MySQL msql;
 PApplet p;
 
 String s;


 String user     = "root";

 String pass     = "root";

 String database = "database";  

 String table    = "table";
 
 
 MysqlAnfrage(PApplet p)
 {
   
   msql = new MySQL( "localhost", database, user, pass, p);
   
     if(!msql.connect())
        {
         
           println("connection failed");
       
        }
   
 }

 
 void getData() {
     
   msql.query( "SELECT * FROM " + table + " WHERE NOT image  ='' AND disable = 0  AND deleted = 0 ORDER BY uid");
   
   String s = msql.getString("image");
     
 }
 
}
Re: mysql class | java.lang.NullPointerExcept
Reply #1 - Mar 28th, 2007, 3:57pm
 
What are you actually passing in to the object when you create an instance of MysqlAnfrange ?
Page Index Toggle Pages: 1