Creating High-Performance Database Applications with Java Triggers and the Oracle Database
In a typical three-tier Java application — Client, App Server, and Database &mdash developers build all the logic into the second tier. The application server uses JDBC to interact with the database over a network connection, and maintains a polling thread to check the database periodically for state changes. How often to poll is a difficult question: polling too often can diminish application performance, while not polling often enough can cause data-related application problems.
As an alternative, developers can move some of the application logic to the third tier, in the form of Java triggers. Not only does this eliminate the need to poll the database for state changes, but tests have shown that JDBC operations performed by Oracle's internal JVM rather than an external JVM can increase performance by up to 600%.
How is this possible? The Oracle JVM resides on the same machine as the database, so they can communicate without any network overhead. It exists in the same address space as the SQL engine, so the Java code doesn't need IPC or RPC to connect to the database. And it reuses the existing database connection, reducing overhead associated with creating new connections.