1. Use data connection pooling (Connection pool) to avoid using drivermanager.getconnection.
2. Reasonable configuration data connection pool parameters, set the initial size of the data connection pool, the maximum number of connections, the connection time-out and so on.
3. Select the appropriate transaction level and select a different transaction level according to the different database operation types.
4. Close the connection in a timely manner, without shutting down will seriously affect the performance of the system and even cause a system strike.
5. Optimize statement
1) Choose the appropriate statement, according to different database operation Choose Statement, PreparedStatement or CallableStatement, the specific choice which can be understood through the search engine.
2) Use batch as much as possible, which reduces the number of calls to JDBC. The specific method is to use Statement.addbatch ("Your SQL") to add batch, and then execute Statement.executebatch () to execute together.
3) Close STATEMENT6 after statement execution. Optimize your SQL and try to reduce your result set, not every time "select * from XXX" 7. Using some caching tools for caching, especially for large data volumes, a reasonable cache tends to significantly improve the performance of the system.
How can you improve the performance of accessing the database using JDBC?