views:

5149

answers:

5

Is it possible to directly access MySql databases through an Adobe AIR/Flex application?
If not, what is the next best alternative?

A: 

I would not recommend accessing the database directly. I describe how I'd do it here.

duffymo
A: 

No, although AIR does have a local (client-side) SQLite database builtin. You don't really want your client apps to have direct access to the server-side database anyways, it can really cause weird problems and open security issues up. You can expose a MySQL database with web services however. This article has a really easy way of doing it.

Abdullah Jibaly
+2  A: 

I'd have to disagree (though respectfully!) with Abdullah that building an ODBC client into AIR would "cause wierd problems and open up security issues" -- that's often how it's done (e.g., Java and .NET, both of whose runtimes package various ODBC clients) -- but both posters are right: the only way's coding some sort of a service interface into your AIR application (using Flex classes like WebService, HTTPService, and so on) and a complementary server-side interface (e.g., REST via PHP, which would then connect up with your MySQL database). For simple apps, it can be a bit of a pain, but for the moment, that's all we gots. :)

Best of luck!

Christian Nunciato
A: 

I haven't tried yes but there are some projects to implement a native driver in AS3 to connect to mysql server. In the end it's just a socket connection and AIR applications are allowed to open socket. Have a look at http://code.google.com/p/assql/

wezzy
A: 

IMHO, the best way to access any Database from a Flex APP (Air or Flash) is to create a webservice. After a few tryouts with PHP, i got into WSDL SOAP webservice build in C# and it´s a beauty! From C#, i got the PostgreSQL, MySQL, SQL-SERVER or Oracle anytime. And using Flex Builder, you can import the WSDL so the objects and webmethod created on the WSDL side will be created for you, with events, listenerers and objects. Try. With C# or Java or any other language, the WSDL SOAP is a great alternative.

flaviocarmo