So first of all, this is how my Planer looks if I open it up:
If i click "Neue Veranstaltung" (= new event), this PopUp opens:
Having filled everything and trying to upload it to the database I recieve the following:
And this is the according error-log:
So obviously there's something not working with saving the input ;)
So here is the addEvent.jsp (I removed everything around the <body></body> for saving space)
And this is my Main code:
So there is some kind of Problem in the code for connecting to the databank I guess, becuase there are no events shown (-> screenshot 1), but in my DB I allready added two (on the other hand, I wrote a very short programm for reading just 1 event and immediatly printing it, just to check if it works - that worked fine - so DB Connection is working, but why is nothing shown?). Or did I miss something?
And for what reason do I get the NullPointerException, as I have all parameters listed, filled, and passed over to modelplaner?
If anyone would not be to bored to read all those lines it would be awesome :D
Thanks in advice and best regards
There it says that in ModelPlaner, in method eventExists at line 296 you are trying to do something with an Object that is null
Markus Reis wrote:Yep, I found that too. It's that
But I dont see what I have to change exactly - true they're both initialized null, but doenst it use the paramaters i send to the method when I "createStatement"?
You maybe have an idea how to rewrite it to make it work? ;)
Your connection attribute is never initialized, you are initializing a Connection cn Object in your constructor, not the class attribute.
connection = DriverManager.getConnection( dbUrl, dbUsr, dbPwd );
The point is that in your constructor you initialize an Object (Connection cn) that you only use to initialize the statement, why is that object there? Should that Object not been the connection class attribute instead?
I changed it like that now, but now it says
"Error: , expected instead of ;"
for the line
Connection connection = null;
How initialize it global then, because with , it obviously wont work?
I have a feeling that we are getting close to a solution ;)
so you mean like that? (also with the statement initialization?)
I'm very sorry but as you maybe allready figured out I suck at mysql / jsp stuff but I need to finish this till wednesday for university ;)
Btw: if that'd be the right idea now (not expecting that tho), it throws
if I open it on localhost (but I still see the table) - the driver worked well before.
And yes indeed you seemed to mean that - now that "Neue Veranstaltung" doesnt throw that exception anymore, I enter the data, click "Erstellen" (=create) and the window closes.
Too bad it doesnt get added to the table (neither in browser, nor in SQL-Database) :)