03-20-2012, 03:16 PM
|
#1
|
|
Registered User
Join Date: Mar 2012
Posts: 22
|
Database recommendations
Morning all! Excuse my ignorance here (this might not even be the right forum to post this), but I need some help.
In my program, I have need of a rather basic database. The database will just be readonly, and will be read at the start of the program and then will not be used again for the duration.
However, I am completely new to implementation of databases, both in general and also to use them with Actionscript. Would any of you be willing to recommend 1) What kind of database to use, 2) The best / simplest way to read databases into Actionscript, and/or 3) Simple guides to help me wrap my head around all the various terminology involved? I see PHP and MySQL tossed around, and I don't know if they're competing technologies, or used at different steps of the process, or WHAT.
Any time you could take out of your busy days would be greatly appreciated.
|
|
|
03-20-2012, 03:46 PM
|
#2
|
|
Super Moderator
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,507
|
A web Flash app has no way of reading directly a database like mySQL. That's why it needs the help of a server side script like PHP to read the db (data from the db) and then pass it to the Flash app in a format that Flash can read and understand. This is done simply from Flash by using URLLoader and load a PHP script (you can pass parameters in the URLRequest), that PHP script log into the db, read the data (maybe using the parameters you passed) then print that data using print() or echo() in a format that Flash can understand (XML, value pair, others). When it's done the URLLoader triggers a COMPLETE event. In this COMPLETE event listener you can read what the PHP printed by using simply e.currentTarget.data (contains anything that was printed).
|
|
|
03-20-2012, 03:59 PM
|
#3
|
|
Software Engineer
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,324
|
Tiny off topic: I wouldn't say "has no way of reading directly a database", because if I remember seeing some really freaky attempts by some people using sockets ( one 'Java-mix' example: http://www.devx.com/webdev/Article/30638 - might not be the best example but if someone is really interested, then a bit of googling will bring up quite a lot of freaky things ). But indeed, I would never recommend doing something like that
On topic: ASWC summed things up quite well. For your needs, you are most likely more than fine with some XML files ( that you can load directly using the URLLoader class in ActionScript 3.0 and parse the file to extract whatever information you need ). Databases are really useful when you want to also write to them some nice amount of data ( using DB for storing some simple configurations would be quite an overkill )...
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.
Last edited by Barna Biro; 03-20-2012 at 04:05 PM.
|
|
|
03-20-2012, 04:09 PM
|
#4
|
|
Super Moderator
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,507
|
Quote:
Originally Posted by Barna Biro
using sockets
|
Still not what you would call 'direct'. You can see the difference with AIR when you can read a SQLite directly using the SQLite based classes. That's what you'll call 'direct' or 'native', no such thing for web Flash so it's all 'indirect'.
|
|
|
03-20-2012, 04:25 PM
|
#5
|
|
Software Engineer
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,324
|
Of course it is not really 'direct' / native since there never was a clear support for such things in AS3 ( maybe never will ). All I was trying to say there have been quite a few 'interesting attempts' to work around such limitantions... As I have already said, I would never recommend such practices in a 'real project'
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.
Last edited by Barna Biro; 03-20-2012 at 04:37 PM.
|
|
|
03-20-2012, 04:29 PM
|
#6
|
|
Super Moderator
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,507
|
Quote:
Originally Posted by Barna Biro
there newer was a clear support for such things in AS3 ( maybe never will )
|
It's not like it's impossible to do, it's just that it would be handling over the key to your db to anyone using your app. That's why front end technology (Flash, Javascript, HTML) will never have direct access to any server side db.
|
|
|
03-20-2012, 04:31 PM
|
#7
|
|
Software Engineer
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,324
|
I did not say it is not possible to do and that is why there might never be support for direct DB access... Just that it might never make enough sense to implement such support when there are so many other options at hand.
Edit: Also, as you have already pointed out, before anything like that is to be implemented, a ton of security concerns would need to be resolved... This is a front-end technology and it is of course not likely for it to ever have native support for accesing a DB ( at least not in the current state but who knows what the future holds ).
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.
Last edited by Barna Biro; 03-20-2012 at 04:38 PM.
|
|
|
03-20-2012, 05:52 PM
|
#8
|
|
Senior Member
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 1,888
|
OP - what is the purpose/role of the database?
XML is probably a better choice for an external data source, especially if you are new to actionscript and don't actually need a database.
|
|
|
03-20-2012, 06:12 PM
|
#9
|
|
Registered User
Join Date: Mar 2012
Posts: 22
|
Snickel: The program is going to read in plain text which is going to be used to dynamically create a number of pictures (loaderObjects) and buttons for the user to interact with. I'm wanting to use a database so that the groups I give the finished program to can alter the DB as needed to update the pictures / button information, without a need for them to interact with the program itself.
|
|
|
03-20-2012, 06:26 PM
|
#10
|
|
Software Engineer
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,324
|
You can do all the above with simple XML. You do not need a DB for that and "plain text files" instead of XML would be a complete pain to work with.
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.
Last edited by Barna Biro; 03-20-2012 at 07:07 PM.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 02:53 PM.
///
|
|