Forum Stats

  • 3,782,585 Users
  • 2,254,669 Discussions


How to Invoke a Java Method from pl/sql

485418 Member Posts: 244
edited Oct 28, 2008 12:43PM in JDeveloper and ADF
I would like to invoke a Java method, which I intend to use to add members to a collection in ApEx from another data source.

How does one invoke a Java method from within ApEx?



  • jflack
    jflack Member Posts: 1,516 Bronze Trophy
    edited Oct 28, 2008 10:03AM
    You need to make the class into a Java Stored Procedure and deploy it to the database, along with a PL/SQL skeleton package (you could do it with a standalone function or procedure, but a package is better) to interface between Java and PL/SQL. JDeveloper can help you with this. First of all, in the properties of your Project, make sure that "Database" and "Java" are included in your Technology Scope. Next create and test your Java class containing the method that you want to invoke from PL/SQL. Select the project, right click and select "New". From the New Gallery, choose "Deployment Profiles". The type of deployment profile you need is "Loadjava and Java Stored Procedures". Give it a name and a directory and save the ".deploy" file. Right click it and "Add a PL/SQL Package". Right click the package and "Add Stored Procedure". Choose the method that you want to expose through this PL/SQL package. You can repeat this step to expose other methods in your class. Finally, you can right click the deployment profile, and choose "Deploy to ...". Deploy to any database connection that you have already created, or create a new connection.
  • 485418
    485418 Member Posts: 244
    I'll take your word for it. I managed to get the class compiled in the database and I can call it from a function.

    Now I have a different problem having to do with wrong number or types of arguments in my call to APEX_COLLECTION. I'll probably put that in another post.

This discussion has been closed.