Question: in java using postgresql im trying to take a number from one of my tables and then add it to the new user input but

in java using postgresql

im trying to take a number from one of my tables and then add it to the new user input but im having some trouble .

public Bank deposit(double account_balance) { try(Connection conn = ConnectionUt.getConnection()){ String sql = "SELECT * FROM bank_account WHERE account_balance = " + account_balance + ";"; Statement statement = conn.createStatement(); List list = new ArrayList<>(); ResultSet result = statement.executeQuery(sql); Bank bank = new Bank(); bank.setAccountBalance(result.getDouble("account_balance")); list.add(bank); bank = bank + account_balance; }catch (SQLException e){ e.printStackTrace(); } return null; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!