A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: XML, relational database and NO middleware, is it possible

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Location
    Amsterdam
    Posts
    5

    XML, relational database and NO middleware, is it possible

    Dear Forum,

    hereby my first post on this forum. The future must be looking bright !

    I have a quick question, has anybody tried to feed Flash a relational database through XML, without the use of any middleware (PHP, ASP, Coldfusion) ? I've searched the web, but it is hard to find any specific info on this subject, therefore i turn to this forum.

    I have two solutions in mind. The first involves loading all the tables of the relational databse seperately to the Flash, and make the relation in Flash by hand.

    The other one is to generate 1 big join file on the database side and feed this dog to flash via XML, but by this, all the nifty things won by relations are lost !

    I'm open to any reactions on this subject, also with the theme "sure-d, what are ya thinking, dont do this, it's stupid !",

    Thanks,

    sure-d

  2. #2
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Flash doesn't have database drivers to talk to databases. The only way I can see this working is if your database provides web access to your XML data, so that Flash can get at it.

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  3. #3
    Junior Member
    Join Date
    Oct 2004
    Location
    Amsterdam
    Posts
    5
    This is exactly what I do. The Filemaker Pro database export the data as an XML file, after given a HTTP request by the Flash Movie, which looks this:

    http://localhost:591/FMPro?-db=FAQ.f...o_xml&-findall

    This is sweet already, I have the data in Flash, but at the same time I can change and maintain the data in FMPro, which is a wysiwig, UI friendly enviroment in which I, but also my collegues can work easily.

    But what about relational databases, how would you feed this kind of data to Flash. Would ya import all seperated (related) tables seperately ? So every table is one XML object, or connected through one XML connector. Or would ya make/generate I big "join" file/table at the database side, in which you collect all the info, and then export this to XML and feed it to Flash.

    I dont know whether I'm clear about what is what. So I would like to post an explanation. What i mean by tables, are the seperate simple form databases/tables which dont have any relations. By a relational database, I mean a collection of tables, with relations between the tables. By a join file/table, I understand a table which is generated using the relational database, presenting the data in the relational database in a simple form manner. This table is made up by the seperate tables and their relations and is generated, so it cant be edited. Of course this join file is populated by "errors" which a relational database solved, but this is ok, because the table is generated and not made by hand.

    anyhow, i'm looking forward to any reactions on this subject. Maybe you know some links or other threads or have some ideas.

    thx,
    sure-d

  4. #4
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Typically you can use the following default mapping for Relation tables to XML:

    Each Row in a table becomes a node. Each field in the row is an attibute of the node. Each related node becomes a child node of the parent node.

    The biggest trick with large databases is that you don't want to ship out all of the data to flash so you have to dynamically grab the bits you want. (eg backend development)

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  5. #5
    Junior Member
    Join Date
    Oct 2004
    Location
    Amsterdam
    Posts
    5
    Hi Luke,

    thanks for your reply. This is something valuable to me.

    Thanks for the paradigma, ie the way to work. Would you or anybody else know some articles on this subject. Maybe it is easy available, but to me as a newbee cant really find that much of valuable information to me.

    So this would mean as well to look into FMPro, to see how I can address the database via HTTP such that I only get the info I want, and this over and over again.

    So, thanks for your knowhow, and I will keep this forum updated with my progression,

    Sure-D
    Last edited by SurE-D; 11-01-2004 at 05:25 AM.

  6. #6
    >>SubKloda<<
    Join Date
    Nov 2002
    Location
    Look Behind You
    Posts
    85
    Hi There,
    one problem i would see with having each table exported as an xml file, is that when you come to do a query based on more than one table of data, the flash would have to do all the hard work, rather than letting the DB do what it's been designed for, and unless your DB supports direct xml output (eg. oracle), there's always going to be a need for some server-side processing (whether it's a flat or joined table)...

    cheers,
    Andy


    Originally posted by SurE-D
    This is exactly what I do. The Filemaker Pro database export the data as an XML file, after given a HTTP request by the Flash Movie, which looks this:

    http://localhost:591/FMPro?-db=FAQ.f...o_xml&-findall

    This is sweet already, I have the data in Flash, but at the same time I can change and maintain the data in FMPro, which is a wysiwig, UI friendly enviroment in which I, but also my collegues can work easily.

    But what about relational databases, how would you feed this kind of data to Flash. Would ya import all seperated (related) tables seperately ? So every table is one XML object, or connected through one XML connector. Or would ya make/generate I big "join" file/table at the database side, in which you collect all the info, and then export this to XML and feed it to Flash.

    I dont know whether I'm clear about what is what. So I would like to post an explanation. What i mean by tables, are the seperate simple form databases/tables which dont have any relations. By a relational database, I mean a collection of tables, with relations between the tables. By a join file/table, I understand a table which is generated using the relational database, presenting the data in the relational database in a simple form manner. This table is made up by the seperate tables and their relations and is generated, so it cant be edited. Of course this join file is populated by "errors" which a relational database solved, but this is ok, because the table is generated and not made by hand.

    anyhow, i'm looking forward to any reactions on this subject. Maybe you know some links or other threads or have some ideas.

    thx,
    sure-d

  7. #7
    Junior Member
    Join Date
    Oct 2004
    Location
    Amsterdam
    Posts
    5
    FMPro supports direct XML output. So the XML file is exported at runtime, via HTTP request. This looks something like:

    http://localhost:591/FMPRo?-DB=MyDat...ormat=-dso_xml ...

    Also, queries can be made at runtime via HTTP request, by using the proper variables or action tags as they are called in FMPro. So pretty much, the Database will be doing what it is made for and Flash will just serve as interface and presentation tier (as they call in it at MacroMedia).

    I guess MacroMedia would describe my solution as follows:

    Business Tier: FMPro
    Logic Tier: Flash (instead of middleware, coldfusion/php/asp/flash remoting ... )
    Presentation Tier: Flash

    I thought these were the tier macromedia came up with ...

    Anyhow, thanks for your interest and reaction, I appreciate it,

    SurE-D

  8. #8
    Junior Member
    Join Date
    Oct 2004
    Location
    Amsterdam
    Posts
    5
    Hey Forum,

    I just wanted to let you know that I've come with a solution to my FileMakerPro-XML-Flash thingie. With the use of XPath (external class XPathDocument @ http://www.xfactorstudio.com/Actionscript/AS2/XPath/ ), i've been query-ing the database via http-requests en used the returned XML to present my data to Flash. So, not the whole of the database is exported to XML, but I just search for the data I need at that time. Which is like back-end programming (I hope).

    So Flash/AS doesnt do any hard work, searching the data, which is good, but it does need the work with the data and make-up extra queries to get the right data, which isnt that elegant. An example. I want to get relational data out of another file. First I need make a query from client to server to to get the data from the join-file. Then I get the data of the join-file from server to client. At client side I need to get the actual data from another file, given the ID's in the join-file, so I make another query from client to server and then I get the data I want from server to client again. So allot of quering and http traffic going on, which could make the application slow, which I need to test.

    Furthermore, the script has to wait a lot of times to get the XML data and only proceed when the data is in, this makes up for some extra programming and not so elegant solutions.

    sure-d

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center