Skip to content
Advertisement

preparedstatement stopped working after inserting into database

I wanted to insert into table called accounts from user input but this is the error. It used to work but suddenly i dont know what happened and it doesnt work anymore

Error code:

Exception in thread “main” java.lang.NullPointerException

at pl.marcinek.sql.sql.register(sql.java:28)

at pl.marcinek.accounts.Register.Register(Register.java:32)

at pl.marcinek.Main.main(Main.java:19)

Sql class

Register class

Main class

Advertisement

Answer

You forgot to assign result of call to Connection#prepareStatement() into variable:

should be

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement