Middle Tier for Java and PHP  
Author Message
John





PostPosted: 2006-4-6 1:39:00 Top

java-programmer, Middle Tier for Java and PHP 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
 
vjg





PostPosted: 2006-4-6 1:53:00 Top

java-programmer >> Middle Tier for Java and PHP 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.

 
John





PostPosted: 2006-4-6 17:02:00 Top

java-programmer >> Middle Tier for Java and PHP vjg wrote:
> 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
 
 
vjg





PostPosted: 2006-4-6 23:56:00 Top

java-programmer >> Middle Tier for Java and PHP So, these aren't two different apps? These are two different
implementations of the same app (or at least the same transactions)?

 
 
Larry





PostPosted: 2006-4-7 3:12:00 Top

java-programmer >> Middle Tier for Java and PHP 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.

 
 
John





PostPosted: 2006-4-7 19:10:00 Top

java-programmer >> Middle Tier for Java and PHP vjg wrote:
> 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
 
 
Alex Hunsley





PostPosted: 2006-4-7 23:21:00 Top

java-programmer >> Middle Tier for Java and PHP vjg wrote:
> 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.

 
 
Alex Hunsley





PostPosted: 2006-4-7 23:27:00 Top

java-programmer >> Middle Tier for Java and PHP John wrote:
> vjg wrote:
>> 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.

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. .