MySQL access in Adobe Flex

March 16, 2007 – 9:51 am

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.

  1. 8 Responses to “MySQL access in Adobe Flex”

  2. what are the advantages of this approach of connecting directly to mysql using flex? i think it sounds cool

    By knowledge chikuse on Dec 30, 2007

  3. what are the security risks? I love Flex and am new to PHP/MySQL, but am very interested in your approach. Amazing!

    By colorful tones on Mar 2, 2008

  4. 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.

    By Russ on Mar 2, 2008

  5. 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.

    By Radek on Mar 3, 2008

  6. 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).

    By mloncaric on Mar 3, 2008

  7. 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

    By Shailesh Mangal on Mar 3, 2008

  8. 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

    By Scott on Jun 18, 2008

  9. 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

    By Abdul Areef on Sep 17, 2008

Post a Comment