

process if any more statements are remaining in the batch PreparedStatementWithdraw.executeBatch()

set the params and start adding your batch statements, as per your requirement, something like Int batchLimit = 1000 //limit that you can vary PreparedStatementDeposit = connection.prepareStatement(.) īoolean autoCommit = connection.getAutoCommit()
#Insert statement in gx works 2 code#
So your code would look something like this: preparedStatementWithdraw = connection.prepareStatement(.)

PreparedStatement = connection.prepareStatement("UPDATE bankAccount SET checkingBalance = checkingBalance - ? WHERE id = ?") Public static PreparedStatement withdrawFromChecking(Connection connection, PreparedStatement preparedStatement, BigDecimal balance, int id) throws SQLException preparedStatementWithdraw.executeBatch()

preparedStatementDeposit.executeBatch() PreparedStatementDeposit = depositIntoSaving(connection, preparedStatementDeposit, new BigDecimal(300), 1) PreparedStatementWithdraw = withdrawFromChecking(connection, preparedStatementWithdraw, new BigDecimal(100), 1) PreparedStatement preparedStatementDeposit = null Ĭonnection = DriverManager.getConnection("jdbc:mysql://localhost:3306/youtube", "root", "root") PreparedStatement preparedStatementWithdraw = null Can anyone tell me what to put in place of those comments to get this thing to work? import I want to send two different prepared statements in one single batch.Ĭurrently I am doing this in two as you can see in the commented lines and it works, but that is not the main objective here.
