Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Middle Tier for Java and PHP

Thread view: 
John - 05 Apr 2006 18:38 GMT
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 - 05 Apr 2006 18:52 GMT
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 - 06 Apr 2006 10:02 GMT
> 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 - 06 Apr 2006 16:55 GMT
So, these aren't two different apps? These are two different
implementations of the same app (or at least the same transactions)?
John - 07 Apr 2006 12:10 GMT
> 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 - 07 Apr 2006 16:26 GMT
>> So, these aren't two different apps? These are two different
>> implementations of the same app (or at least the same transactions)?
[quoted text clipped - 5 lines]
> 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. .
Alex Hunsley - 07 Apr 2006 16:20 GMT
> 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.
Larry - 06 Apr 2006 20:12 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.