Invoking middle tier from database tier

Discussions

General J2EE: Invoking middle tier from database tier

  1. Invoking middle tier from database tier (9 messages)

    We have a requirement to invoke a piece of middle tier functionality (in a J2EE app server) from a database (PL/SQL code in Oracle 9i).

    Our middle tier is a very basic JSP/servlets-based web application, no EJBs or JMS etc.

    Any suggestions on how this could be best achieved?

    Previous solutions used at my company have been to generate a HTTP/HTTPS request, which is slow, in-secure (can be easily be faked) and clunky (esp error handling).

    Cheers,

      Chris.

    Threaded Messages (9)

  2. Somebody else recently posted a link to this article:

    http://www.oracle.com/technology/tech/java/java_db/pdf/OW_30820_JAVA_STO
    RED_PROC_paper.PDF

    Page 11 talks about having a database call back to the web tier to flush a cache, I think.

    cheers,
    Eric
  3. Somebody else recently posted a link to this article:

    http://www.oracle.com/technology/tech/java/java_db/pdf/OW_30820_JAVA_STORED_PROC_paper.PDF

    Page 11 talks about having a database call back to the web tier to flush a cache, I think.

    cheers,
    Eric
  4. Thanks for the link Eric. Unfortunately this is simply using a HTTP request, which is what I wanted to avoid...
  5. Thanks for the link Eric. Unfortunately this is simply using a HTTP request, which is what I wanted to avoid...

    Hhm, what else would be doable? I'm really interested since we are basically doing the same when a callback to the middle tier is needed (we are calling .NET web services from PL/SQL).

    Best regards,
    Stefan
  6. It seems to me you need to make two decisions here.

    1. What interface would you like to expose on your application? Right now it is HTTP, which you don't like. Alternative include RMI, SLSB, SOAP, etc. If you own both the caller and the callee, this probably doesn't make much difference. Factors like familiarity with the technology and your security requirements should come into play here.

    2. Putting a stored Java procedure in your database means you can contact your application over whatever interface you have exposed. So, having a database trigger invoke a stored Java procedure which makes an RMI call to your application seems doable.

    The point of the article is that you can run Java in your database, and that Java can do anything Java can do! The fact that they used HTTP doesn't mean you have to.
  7. Cheers for your suggestions. I have some familiarity with SOAP over HTTP, so that might be best given our security requirements (we could use WS-Security to do strong authentication).

    I'm not very familiar with RMI and am not sure what security options are available and "easy" to use over RMI? I guess that RMI would be quicker than SOAP, given there is very little information that will need to be passed.

    As our application doesn't have an EJB layer I wouldn't want to introduce a SLSB just for this.

    Are there any other options anyone can recommend? I've heard of various other remoting frameworks but haven't actually used them?
  8. JMS[ Go to top ]

    Are there any other options anyone can recommend?

    You could always have your database stored Java procedure write a JMS message to a queue and have an MDB or some MessageListener started during your web app initialization listen for it.
  9. Will come back to haunt you.[ Go to top ]

    Having the data tier call up to the middle tier in my opionon is bad design. re-analyis the requirement. I really can't imagine why you "MUST" call a business method out up from the data tier.
  10. Will come back to haunt you.[ Go to top ]

    I tend to agree with you. However, the case Oracle mentions in that whitepaper isn't necessarily an indication of a bad design. Signalling the middle tier to flush its cache may be impossible to avoid, depending on how the data changes, and how other systems are using the database.