Corporate Info | News | Solutions | Products | Partners | Services | Events | Download | How To Buy

# Optimizing JDBC performance in an applet Once you have created your applet using WebLogic/JDBC, you will want to do some fine tuning to improve performance. One consideration in optimizing performance is how you use JDBC connections. There is a trade-off between keeping a client's connection open to the WebLogic Server and the database -- which may cause you to run out of server-side resources -- and closing and reopening the client's connection to the database for each query, which requires a few seconds. This can be particularly troublesome if you have many applet clients and not enough database connections to the DBMS server available. The WebLogic Server offers several possible solutions to this problem. The first thing you should consider is using WebLogic connection pools. Connection pools are a collection of open connections maintained on the WebLogic Server. Whenever you open a WebLogic/JDBC connection, WebLogic will use one of the pool connections rather than making a time-consuming DBMS connection. When you close the JDBC connection, it is returned to the pool for reuse. Therefore, you can open a JDBC connection for each query without a major performance hit. Connection pools also have the advantage of allowing you to limit the number of DBMS server connections, which can improve management of DBMS resources. Next you should decide whether you want to maintain an open a connection to the WebLogic Server between queries or whether you wish to open the WebLogic Server connection right before you open the JDBC connection and then close it right after closing the JDBC connection. Here are the advantages and disadvantages of each approach. Maintain a connection to the WebLogic Server Pro: - Minimize time delays Con: - You must include code on the client to detect if the connection to the WebLogic Server has been broken and, if so, to re-establish it - You tie up resources on the WebLogic Server: namely, some memory, two threads, and a socket for each connection to the WebLogic Server. Close/re-open the connection to the WebLogic Server for each operation Pro: - Minimize use of server resources Con: - Small performance penalty each time a connection is opened to the WebLogic Server If you have clients that make many fast queries, you might choose the first approach. If you have applets that only occasionally make long queries to the database, the second approach might be better.

Copyright © 2000 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher. Last updated 01/13/1999