Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

zimv20

macrumors 601
Original poster
Jul 18, 2002
4,402
11
toronto
i have a website w/ a normalized mysql DB and php code to get it all running. this includes data display and, in some cases, data update.

i'd like to re-do the website, starting only with the DB and its data. further, i'd like to find some technology which would read the DB structure and facilitate XML communication w/ the mysql server.

iow, from an MVC perspective, i want this tool (or what it produces) to be the model -- with persistence being handled by my existing DB -- while i go off and write views and controllers in some other XML-compatible technology.

so: what tools/technologies should i be looking at? ideally, i'd like to code as little as possible (since i'll have my hands full w/ the other stuff).

this must run on a LAMP server against mysql 4.1.21.
 
Sounds like you want some web application framework, like Ruby On Rails.

I don't know if it will meet your specific requirements but you could have a look at cakePHP.

You could also do worse than spend 20 minutes watching http://oodt.jpl.nasa.gov/better-web-app.mov which (although, IMHO, a bit out of date and anti-Java) outlines the capabilities of these frameworks, so you can see if this sort of framework is what you are looking for.
 
Sounds like you want some web application framework, like Ruby On Rails.
no, i just want a database wrapper.

What do you mean, "XML communication" with the DB??
yeah, i wasn't very clear on that.

right now, i'm writing selects and inserts in php, and that's all jumbled with the display code. i want to stick an XML layer between the client and server, because i'll eventually have a number of clients running and i don't want any notion of display on the server. that's the goal.

if you're familiar with CORBA, this is similar to one of the CORBA sales points: "if you have functioning code, you can wrap it in a CORBA layer, define an interface, and offer it as a service". i want to do the same kind of thing, except i'm wrapping a mysql database with an XML layer.

anyway, the tool i'm envisioning will work in one of two ways:

1. it will read the db schema and generate code to do selects to XML and inserts from XML. i'd then run this code on the server.

2. it will work as an adapter to the mysql instance and handle select and insert requests on the fly. as above, select requests will result in an XML stream, and it will accept an XML stream specifying inserts/updates.

what i'm writing is a 2-tier app, any logic i'll handle on the client side(s). but i want to start with my existing schema, and i don't want something which will dictate to what i do on the client side (as i suspect RoR will, but i don't know enough about RoR to say for certain. if it can do what i want, then great).

...

as i mentioned above, yes, i could just write the wrapper code myself, but i don't want to. ideally, whatever solution i find will easily handle changes to the schema.

does this thing not exist? i'd be surprised if no one else has found a need for it.

You could also do worse than spend 20 minutes watching http://oodt.jpl.nasa.gov/better-web-app.mov
thanks for the link, btw. i've watched it before, but had completely forgotten about it.
 
If I understand well, the client you're talking about is a webapp on a server, not the client the end-user executes, right?
 
If I understand well, the client you're talking about is a webapp on a server, not the client the end-user executes, right?
initially, there'll be a flex/actionscript webapp with which the user interacts. after that, who knows how i'll use the data. but for the adobe frontend, it's gotta be XML.

the two tiers are:
1. user-interaction in a browser, and
2. the webserver (no logic, just persistence)
 
OK, even if you don't have a webapp, you can still use it on the db tier, so what I was guessing for was Cocoon.

Unless you want to program your XMLized db query server yourself, this you can do with a web server/servlet engine running Cocoon which gives XML responses with this: http://cocoon.apache.org/2.1/userdocs/sql-transformer.html.
To handle the requests, use forms taking XML input which you parse and convert somehow. So, this is a "db tier" webapp.

If you have a webapp server, use Cocoon to do all the presentation handling with XML and XSLT (typical). You should make a generator or something that connects to the other tier.

But if you have a webapp the easiest thing to do, and what I would try to go for, is having both of these things in the same webapp, then you don't have to bother maintaining two installations, there is less overhead, and the real webapp is simpler.
You just use different matchers in the sitemap, and one of the flows just grabs the data from the db, converts to XML, maybe transforms to another XML format that the client requires (the only step that you might need to develop, one XSLT for each of such output formats you require), and serialize.
The other matcher can take get any of the previous XML formats (preferably the "raw" one), transforms to XHTML with your own developed XSLT, and then just uses the serializer to HTML.

There's only 3 oldish only-Cocoon books, and of those only 2 have a good rating at Amazon, so get those. There are some newer things like Cocoon Forms and Flowscript that you'll have to learn from the web or mailing list.

For the New Cocoon Way, with the Flowscript, the best place to start is the
Supersonic Tour of Cocoon

You can also hook up Cocoon with Spring very easily, but I don't know how to use Acegi instead of the Cocoon authentication framework (I'm not saying it can't be done).

You can also make portals.

And Lenya is a Content Management System based on Cocoon.

You program in Java+Javascript+XSLT (originally, the Flowscript was Scheme, but the devs went for Javascript because "more marketable" - GRRR).
 
thanks, i'll look into cocoon. (seems i still have to write my own SQL, though. maybe i'll have to invent the tool i need :)
 
my hosting company doesn't run cocoon. so that's out, though it does look interesting.

aren't there a bunch of RoR fans here? can RoR do what i need, or do i have to buy into the entire framework?
 
Tell them to provide Cocoon or you go.
i rather like this host, all in all. and i've got some 30 domains hanging off that one account, so i'm rather settled in. i figured any move i make would be to a dedicated server, but i'm not ready for that yet.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.