JDBC—Best Practices

Most Web applications include some sort of a database access—thus making JDBC one of the most crucial components in an application. Therefore, it's important to take several factors into account while working with JDBC to improve performance of the overall application. In this section, we discuss some of the aspects that you must remember while programming with JDBC.

Use Smart Queries

Database queries can often be the most time-consuming aspect of your application. Make sure that you optimize your queries as much as possible. Never query more data than you require. This applies for columns, too. It's preferable to SELECT the fields that you need rather than performing a SELECT *. Avoid using database clauses such as count(*) ...

Get BEA WebLogic Server™ 8.1 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.