MySQL access in Adobe Flex
Over the last few days I've been writing a shared library to connect directly to MySQL in ActionScript (a great way to learn the Socket and ByteArray classes ha). The code is now compiling without any errors or warnings but still needs a lot of testing. Over the weekend I'll make sure everything works correctly and also make it more Flex-friendly. I think it would be pretty cool to be able to query the db directly from ActionScript and have the results bindable to a DataGrid.
Although connecting directly to MySQL from Flash probably isn't the best idea for most applications, I'm mainly doing this for the learning experience. My plans are the following:
1. Complete the ActionScript MySQL Client
2. Modify/abstract the code to allow other database drivers (JDBC, ODBC, DBI, PDO-ish style)
3. Code a simple object-to-relational mapping framework (Similar to ActiveRecord)
4. Build a database administration app using the Flex framework
I'll keep everyone updated on my progress and I'll release the code as it is completed. I hope to hear anyones comments on similar ideas.


December 30th, 2007 - 03:23
what are the advantages of this approach of connecting directly to mysql using flex? i think it sounds cool
March 2nd, 2008 - 17:02
what are the security risks? I love Flex and am new to PHP/MySQL, but am very interested in your approach. Amazing!
March 2nd, 2008 - 18:54
Would never do this over the web, but this would be great for AIR apps. External db connection is the real missing piece of AIR imho.
March 3rd, 2008 - 05:38
AiR provides SQLLite built-in. By the way – I don’t think opening DB server for everyone is good idea. IMO web services in MSSQL 2005 are much better approach.
March 3rd, 2008 - 07:17
Check this project: http://code.google.com/p/asqlib/
Maybe you will find it useful.
(I haven’t tested it with mysql so far, only with sqlite, but I think it will work).
March 3rd, 2008 - 11:43
wondering if you were able to finish this. Are you planning to release the code.
I think its a neat idea to have a mysql connector straight from client tier. It make sense for intranet applications as it will alleviate the pain of maintaining the middle tier specially for tiny apps.
-Shailesh
Now, test management is a breeze
June 18th, 2008 - 17:15
Hi,
I’m curiuos if you ever finished this code. I’m working on a flex application that uses a MySQL database and I’d love to access it directly from flex instead of writing php code. Could you send me the source code if you’ve finished it?
Thanks,
Scott
September 17th, 2008 - 23:15
Hi,
i am new to Flex World,i focusing on Integrating Flex with Struts or Javabean. If you have any idea about this concept means, please share your ideas by sending mail to me
– areef@visiontss.com.
thanks in Advance
Areef
April 20th, 2009 - 14:50
Wondering if you have an update?
July 10th, 2009 - 03:49
Do let me know if you have an update!
July 27th, 2009 - 05:19
hai, i am newer in flex.i dont get how to insert
data from flex to mysql
January 6th, 2010 - 14:15
Hi, I am developing an application in Flex (though I am a rookie in Flex). I have created a table in MySQL. and importing it using option “Create Database”. While doing connection the validation and test connection is successful, but after importing it I am unable to run it. The log shows error :
“(Variable_Name) is not a valid identifier”
Every variable I have created in MySQL table throws an error message in Flex log.
Can anybody help me. Please mail me at: me@richie.in
Also, I am designing an interface which would take inputs from user (some text number), insert into MySQL database and then generates a report in Excel.
Any Help on this would be great.
Many thanks.