I know it is a bad practice to use SQL codes and database connection code in a JSP. I want to know is there a performance drawback by using SQL codes and database connection code in a JSP. What are the other drawbacks of doing that?
Database connection is something comes under Business Logic Layer. Using business logic directly in JSP is something like killing the purpose. You are mixing the Presentation Layer with Business Logic Layer.
separation of these layers is counted as best practice and helps developer to makes the code more maintainable.