Ryan Campbell Flex/Flash Developer Blog

16Mar/0712

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.

Filed under: Flex, MySQL Leave a comment
Comments (12) Trackbacks (0)
  1. what are the advantages of this approach of connecting directly to mysql using flex? i think it sounds cool

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

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

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

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

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

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

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

  9. Wondering if you have an update?

  10. Do let me know if you have an update!

  11. hai, i am newer in flex.i dont get how to insert
    data from flex to mysql

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


Leave a comment


No trackbacks yet.

Ryan Campbell

360|Flex DC


follow bobjim at http://twitter.com

Recent Posts

Categories

Archives