What is key diffrence between using a <jsp:forward> and HttpServletResponse.sendRedirect()?

The <jsp:forward> action allows the request to be forwarded to another resource (servlet/jsp/HTMl> which are available in the same web-application (context).
Where as in the case of Response.sendRedirect() the request to be forwarded/redirected to another resource in the same web-application or some other web-application in the same server, or to a resource on some other web-server. The key difference is by using <jsp:forward> single request from a browser can process multiple resources. Where as by using SendRedirect() multiple requests take place in order to process multiple resources.

Why DB connections are not written directly in JSP’s?

The main purpose of JSP is to separate the business logic & presentation logic. DB connections deal with pure java code. If write this kind of code in JSP, servlet container converts the JSP to servlet using JSP compiler which is the time consuming process so this is better to write code which deals with DB connections, Authentication and Authorization etc. in the java bean and use the <jsp:bean> tag to perform the action