11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER <strong>11</strong> ■ APPLICATION DEVELOPMENT 5<strong>11</strong>Improvements to the ojvmjava ToolA new option and command, -runjava, and a new command, connect, have been added to theojvmjava tool. With the new connect command, you can connect to other database users. Thisis similar to SQL*Plus’s connect command. runjava allows the user to specify whether the database’sJVM or the ojvmjava tool should execute the Java, as the location of the classpath. This ishow to use the command-line option -runjava:ojvmjava ... -runjava [server_file_system]Within the ojvmjava shell, the usage for the runjava command is as follows:runjava [on|off|server_file_system]Table <strong>11</strong>-8 describes each of the possible settings for runjava.Table <strong>11</strong>-8. runjava OptionsCommand-Line Option Shell Command Description-runjava runjava on Executable classes are run by ojvmjava.Classpath elements are on the localfile system. runjava off Executable classes are run withDBMS_JAVA by the database’s JVM.-runjava server_file_system runjava server_file_system Same as runjava on except the classpathelements are on the databaseserver’s file system.N/A runjava Prints the current state of runjava.In the following examples, the “Hello, world” program written earlier will be called from theojvmjava shell. First, run ojvmjava without a -runjava option. This executes classes from thedatabase.r<strong>11</strong>b > ojvmjava -u demo/demo--OJVMJAVA----type "help" at the command line for help message$ java hellooracle.MainHello, worldIn this case, the class helloracle.Main was run from the database. Second, run with the-runjava option and Main.class present in the current directory:r<strong>11</strong>b > ojvmjava -u demo/demo -runjava--OJVMJAVA----type "help" at the command line for help message$ java -classpath . hellooracle.MainHello, worldrunjava call succeeded

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!