Middle Tier for Java and PHP

J

John

Hi,

Let's say you have a Java SE Application and a PHP Web App that are both
accessing a database directly. You want to control things more formally
by using a common middle tier (enforcing things in addition to database
constraints / sprocs).

Any experience on what works and/or recommendations?

Thanks,

John
 
V

vjg

Why a common middle tier? What are you trying to control? The database
itself should be handling commitment control enforcement and your two
apps should be written with commitment control in mind. It's the
application that decides things like transaction boundaries, not the DB
and (probably) not some middle tier.
 
J

John

vjg said:
Why a common middle tier? What are you trying to control? The database
itself should be handling commitment control enforcement and your two
apps should be written with commitment control in mind. It's the
application that decides things like transaction boundaries, not the DB
and (probably) not some middle tier.

Let's say you have two applications accessing the same database. If you
implement the transaction boundaries in each of the two applications
then you have redundancy (and the requirement to enforce consistency
across both applications).

If you implement the transaction boundaries in a common middle tier then
you eliminate the redundancy.

John
 
V

vjg

So, these aren't two different apps? These are two different
implementations of the same app (or at least the same transactions)?
 
L

Larry

Sounds like a good place for a java EJB (Enterprise Java Bean), or even
a POJO (Plain Old Java Object). An EJB can be called from the java
app, and possibly PHP (although I don't know enough about PHP to say
this would work) to access the database. Both apps would use the same
component (EJB's) to do the work.
 
J

John

vjg said:
So, these aren't two different apps? These are two different
implementations of the same app (or at least the same transactions)?

They are two different applications. App 1 may carry out transactions in
the set T1 and App 2 may carry out transactions in the set T2. T2 is not
equal to T1, but the intersection of T1 and T2 is not empty.

I've been looking at EJBs to do this (as per Larry's advice), but I have
to check that they will work with PHP.

John
 
A

Alex Hunsley

vjg said:
Why a common middle tier? What are you trying to control? The database
itself should be handling commitment control enforcement and your two
apps should be written with commitment control in mind. It's the
application that decides things like transaction boundaries, not the DB
and (probably) not some middle tier.

While it's true that the app is bound to be concerned with some notion
of transaction boundaries and atomicity etc., it can still make sense to
have the actual transactional details - the actual graft - dealt with by
a middle tier.
 
A

Alex Hunsley

John said:
They are two different applications. App 1 may carry out transactions in
the set T1 and App 2 may carry out transactions in the set T2. T2 is not
equal to T1, but the intersection of T1 and T2 is not empty.

I've been looking at EJBs to do this (as per Larry's advice), but I have
to check that they will work with PHP.

You can certainly access EJBs from PHP. Here's an article about that:

http://www.devx.com/Java/Article/21707

(I've not read this article, so I can't vouch for how good it is)


I'd read up on pros and cons of EJBs, and the alternatives, before
diving in. .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top