Since its inception, the Java Virtual Machine (JVM) has emerged as a pivotal element in computer systems worldwide due to its platform-agnostic nature, enabling Java-based applications to run seamlessly across diverse systems. The Oracle Database Management System, known for its forward-looking adoption of technologies, integrated the JVM starting with its Oracle 8i release. However, beginning with Oracle 11g, the role of the JVM within the Oracle DBMS became more pronounced and indispensable. Let's delve into the key contributions and functionalities of the JVM in Oracle 11g and subsequent releases.
- Platform for Java Stored Procedures: Oracle 11g fortified its commitment to the JVM by optimizing the execution of Java stored procedures. This means that database developers could write Java code directly and store it within the Oracle database, offering more flexibility and language diversity beyond the conventional PL/SQL.
- Java in the Database (JITD): With JVM integration, Oracle databases became capable of executing Java code with native efficiency. Oracle's Just-In-Time (JIT) compiler, a part of the JVM, translates bytecode into native machine code, enhancing execution performance and making Java operations in the database faster.
- Uniformity and Interoperability: The integration of JVM allowed Oracle databases to interoperate seamlessly with other systems and applications. Java's "write once, run anywhere" philosophy found a significant boost within the Oracle ecosystem, ensuring consistency and interoperability in heterogeneous environments.
- Enhanced Security: Oracle 11g's JVM came with robust security enhancements. Java stored procedures run inside the database server's memory space, meaning they adhere to the same security protocols, permissions, and access controls as the Oracle DBMS itself, fortifying data security and integrity.
- Support for Java EE Components: The JVM enabled the Oracle database to support specific Java EE components, such as Java Messaging Services (JMS). This allows for asynchronous communication and the sending/receiving of messages within the database ecosystem, broadening the horizons of database-driven applications.
- Web Services and SOA Integration: With JVM's facilitation, Oracle 11g could more efficiently expose stored procedures as web services, an essential aspect for Service-Oriented Architecture (SOA) environments. This interoperability made the Oracle DBMS more adaptable to modern web-centric architectures and systems.
- Database-Resident JVM (OJVM): The Oracle JVM is often referred to as the "Database-resident JVM" or OJVM. It is optimized for running within an Oracle database, ensuring that Java applications have efficient access to database resources, and benefit from Oracle's scalability, reliability, and security features.
- Java Class Libraries and Utilities: Oracle's JVM integration provided developers with a suite of Java class libraries specifically designed for database operations. These tools streamlined tasks ranging from SQL operations to connection handling and data conversion.
To surmise, beginning with Oracle 11g, the Java Virtual Machine's integration into the Oracle Database Management System was not a mere add-on but a strategic augmentation. By embedding the JVM, Oracle ensured that its databases were ready for the future – more adaptable, more interoperable, and more efficient. This integration underscores Oracle's commitment to staying at the forefront of technological advancements, offering users a blend of reliability, flexibility, and innovation.
There are numerous uses of Java beyond Oracle applications, and there are many features of the language that will not be used by most Oracle developers. The goal of this chapter is to provide developers who have a background in SQL and PL/SQL with an understanding of the Java language structures. This is not an exhaustive review of Java (there are numerous resources that accomplish that goal) but rather a short
overview of the Java language components most commonly used by Oracle developers. Although there are many cases in which PL/SQL and Java correlate well to each other, there are significant differences in terminology and usage. That should not be surprising, since the two programming languages were developed independently. Furthermore, PL/SQL's object-oriented capabilities were not part of its initial implementation, whereas Java has been object-oriented since its inception.
To useJava effectively, you need to take a different approach than the one you may have taken in the past with PL/SQL.