Is it possible to directly access MySql databases through an Adobe AIR/Flex
application?
If not, what is the next best alternative?
相关问题
- sqlyog export query result as csv
- NOT DISTINCT query in mySQL
- MySQL: conduct a basic search
- Should I wait for Flash Player 10.1 or go with Fla
- Why sometimes there is one of more gap(s) in the v
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.
I would not recommend accessing the database directly. I describe how I'd do it here.
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!
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.
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/
Actually, in AIR 2.0, Adobe added NativeProcess functionality. This allows the user to exchange data between applications via the command line's stdin/stdout. The drawback is that you must compile your application as an EXE, DMG, or RPM file as this functionality is not cross platform. MySQL works wonderfully via the command line so this could be a very good option for you. Here's some links on using the functionality.
http://blog.omarfouad.com/?p=277 http://gotoandlearn.com/play.php?id=125 http://gotoandlearn.com/play.php?id=126 http://www.adobe.com/devnet/air/flex/articles/air_screenrecording.html