#NullPointer
1 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @gray oyster! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.connection" is null
See this StackOverflow post for NullPointerExceptions and how to solve them.
@surreal jungle I am newbie with programing and i don't understand how that post can help me
Your GetConnection() always returns null
What can i do then ?
return connection lol
lol
And you shouldn’t use your DatabaseConnector class to execute statements etc.
It’s a utility class. You create a connection once and use it whenever needed
Thanks
Can you explain me how i can use datepicker to get value from that to add to database ?
preparedStatement.setString(2, String.valueOf(dataPicker.getValue()));
is this correct?
anyway it works, thank you
What does DatePicker.getValue() return?
I have no idea where to look 😛
d; DatePicker#getValue
Hover over it in your IDE

ahh its in maintenance
rip
Ah, okay
It’s a LocalDate
@gray oyster if you want to store it ad a date type in your database, you will have to convert it from LocalDate to another type of date afaik
LGTM
So it works?
Yes it works
Alright then