In Java and C#, they both have something like System.terminate(). If my program has open database connections, database readers, and database command variables, and I terminate my program in a catch clause, will database resources still remain in use? or will they be freed automatically since my entire program has just exited?
Normally, how should I handle such cases to make sure I always free database connections, whether through normal program termination or unexpected program termination? Any good practices?