Java Prepared statement not executing

后端 未结 4 511
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-24 02:46

I have created a small 3 tier program, consisting of : front end -> servlet -> database.

Front end I enter some details into a form. They are passed to a servlet, which

4条回答
  •  长情又很酷
    2021-01-24 03:28

    Also, why st = con.createStatement();?

    And why do you have a leading space in your query?

    String query = " INSERT INTO user_information (name, email, country, password)" 
                     + " VALUES (?, ?, ?, ?)";
    

    This leading space may or may not matter...

    Lastly, you should be closing your connection when you're through with it, using try-with-resources or a finally block.

提交回复
热议问题