Pages

Subscribe:

Ads 468x60px

Showing posts with label oracle java. Show all posts
Showing posts with label oracle java. Show all posts

Sunday, 12 February 2012

Developing Oracle Application with Java

Oracle provides us with three java methodologies to develop applications in the database; Java stored procedures, Enterprise JavaBeans EJB, and Common Object Request Broker Architecture CORBA. Java stored procedures work closely with database triggers, functions, and procedures. The Java stored procedures method allows you to move Java applications into the database, execute them with the JVM, and return values to PL/SQL programs. Enterprise JavaBeans is a standard for 100 percent Java distributed applications. To support CORBA, Oracle has an Object Request Broker ORB in the database, allowing Internet Inter-ORB Protocol called IIOP communication with distributed objects in any language, including Java. Java implemented CORBA server and EJB applications require that you use multithreaded / shared server configuration.


Java stored Procedures:

Probably the quickest way to begin using Java in the Oracle database is with Java stored procedures. You can quickly create small Java applications, load them into the database, and call them as you would a PL/SQL procedure. Some note-worthy benefits of Java stored procedures are as follows.

They provide centralized enforcement of business rules.
They are part of the SQLJ standard
The Java language is an alternative and complement of PL/SQL

Write the Java code and load it in the Oracle database.

If you are not already a savvy Java developer, you will need to first understand the difference type of Java files. Java source code files have the .java extension and are simple text files. Java source code is compiled into portable bytecode files that have the extension .class, Java .class, and resource files can be compressed and combined into archive files, which end with the .jar extension. You can load the following types of Java files into the Oracle database.

  1. Source code and then compile it using the database bytecode compiler.
  2. Compiled code like .class or .jar files.
  3. Resource files, such as images.

You can use two methods to load Java files into the Oracle database. One method is to run the Oracle loadjava utility from the command line. Because loadjava simplifies the process, we will refer to it in the following sections. The other method is to execute the Create Java DDL statement from SQL*Plus. This requires the following steps.

  • Write the code, using your favorite text editor or Integrated Development Environment IDE.
  • Load the code into a BLOB or LOB with the created java statement.
  • Manually resolve any external reference.
 
How to load object using Loadjava, this we can learn from our next session. Want more Oracle DBA tutorials? Check our professional online Oracle DBA courses. Dbametrix is leading database dba company to providing database support to global clients with all aspects and requirement of client to manage small to large databases with strong service level agreement and response time.