Question

I need to write an Oracle Java Stored Procedure to write messages to MQ using the stored procedure. I followed the directions from this link and it worked. According to the link, it requires JavaEE api jar to be loaded into the database.

But now I have questions about the role of JavaEE Jar in an Oracle Java Stored procedure. From what I have read, these jars contain only interfaces, no implementations

  1. What role does JavaEE jar play in an Oracle Java Stored Procedure?
  2. If it doesn't have implementaion details, where does it get it from at runtime?
  3. I have been able to write simple Java Stored Procedures without use of these jars, so what are the situations that require use of this jar?
Was it helpful?

Solution

  1. It contains the interfaces for services like EJB, JMS, Resource managers, JDBC (javax.sql), transactions etc. This is to ensure that applications using theses interfaces can be installed in different application servers. It's up to the application server provider to write implementations, but these are not directly needed in a client application.

  2. To get a connection for example, you need to lookup a factory using a naming service. The result from the lookup must be cast to an interface (as the naming service returns Objects). As a result you deal with the interface, but of course there is a vendor specific class in the background which implements it.

  3. If you call Java stored procedures from your JDBC client, the database could be considered to be an application server as well. So in theory anything you do in a Java application server could be done in a stored procedure as well: It's JMS, and possibly transactions services, or calls to other EJB servers. But that's not common practice, and I am not aware of any limitations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top