O'Reilly logo

Oracle and PL/SQL Recipes: A Problem-Solution Approach by Matt Arena, Josh Juneau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

15-2. Loading a Java Database Class into a Database

Problem

You want to load a Java class into a schema within your Oracle Database.

Solution #1

You can use the CREATE JAVA command to load the Java source into the database by copying and pasting the Java source into a SQL file. This is the easiest way to create a Java class and then load it into the database if you are not working directly on the database server but rather remotely using an editor or SQL*Plus. The following lines of SQL code will load the Java class that was created in Recipe 15-1 into the database using the CREATE JAVA command:

CREATE OR REPLACE JAVA SOURCE NAMED "Employees" AS import java.sql.*; import oracle.jdbc.*; public class Employees {   public static void getItEmps(){ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required