To Do: Write a Java Stored Procedure
Now you have a chance to write a Java stored procedure which modifies an employee record to provide the employee a raise and modifies the employee's location. This instance uses Jdeveloper but you can use any Java tool or editor to write the Java program.
For this follow these steps:
1. Start Jdeveloper
2. Choose File, New Project
3. Write the Java programs as shown in Listings updjava and empjava one in each Java source file.
4. Compile both source files: updjava and empjava
5. From the toolbar, select the New button.
6. On the Deployment page, choose Stored Procedure Profile.
7. Click OK to start the Stored Procedure Wizard
8. For the wizard's first two dialog boxes and then click to Next.
9. In the next dialog box, select only the updjava file.
10. Click Next in the Step 3 dialog box
11. In the next dialog box, select Thin JDBC Driver and then Next.
12. Specify the connection parameters that are: username, password, Oracle SID, host ID, and port number and then Click Next.
13. Click Next for the Step 6 dialog box
14. In the next dialog box, select the method that has to be published and then click to Next.
15. Click Finish. The Java method is now loaded and published to SQL.
16. Select the Project pull-down menu from the menu bar
17. On the Run/Debug page, provide the appropriate connection parameters, for example, Jdbc:orcale:thin:@myserver:5521;ORCL scott tiger
18. Choose Send Run Output to Execution Log.
19. Click OK.
20. Compile the empjava file.
21. Run empjava to invoke the procedure