I have a basic question. Every time we write JDBC Code, is it better that we do Connection.setAutoCommit(false); at the beginning and at the end, do, Connection.commit(); Connection.setAutoCommit(true) and close the connection?
Yes, but it is probably better still to use a transaction, which does all that sort of thing implicitly. Also a transaction will roll back your database if an error occurs. Maybe better again to use a stored procedure which embodies a transaction.