understanding Java JDBC error

后端 未结 4 1747
野性不改
野性不改 2021-01-28 16:29

I was hoping to have some assistance in understanding this error. I am making a simple connection to a database, and for some reason it doesn\'t like my input, but I am failing

4条回答
  •  轮回少年
    2021-01-28 16:38

    Change your makeDeposit() methods this line: In this case you are not paasing your variables, but they are used as simple strings.

    String sql = "insert into MYTABLE_TRANSACTIONS (ACCOUNT_ID,TRANSACTION_TYPE,AMOUNT) values(name, action, amount)";
    

    to

    String sql = "insert into MYTABLE_TRANSACTIONS (ACCOUNT_ID,TRANSACTION_TYPE,AMOUNT) values ("+name+", "+action+", "+amount+")";
    

提交回复
热议问题