The following are commonly used Java code for database operations. You can simply copy and paste to your projects.
- Connect MS SQL Server by using SQL Server Authentication
- Connect MS SQL Server by using windows authentication
- Connect Mysql database
- Prototype class for database operations
- Put database connection to ServletContextListener