Java side performance tuning:
- Time your database access to have an idea whether the Java code or the database is the culprit.
- Make sure you are using the right JDBC driver. There are four types of JDBC drivers. Some types, like JDBC-ODBC bridge, are doomed to be slow.
- Be sure to use database connection pool unless your application is entirely single threaded.
- Be sure to close database resources, such as Connection, Statement, ResultSet even in situations when Exception's are thrown.
- Use PreparedStatement correctly.
- Determine whether indexes are necessary to create.
- Update database statistics.
- Run Explain Plan or similar tools on expensive queries to avoid full table scan.
These tips sound like vanilla. However they are proven effective ways to kill 80% of your JDBC performance issues.