Accessing mysql from Adobe flex/AIR

2019-04-07 14:09发布

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

6条回答
再贱就再见
2楼-- · 2019-04-07 14:36

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.

查看更多
女痞
3楼-- · 2019-04-07 14:36

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

查看更多
一夜七次
4楼-- · 2019-04-07 14:46

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!

查看更多
我只想做你的唯一
5楼-- · 2019-04-07 14:54

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.

查看更多
\"骚年 ilove
6楼-- · 2019-04-07 14:56

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/

查看更多
做自己的国王
7楼-- · 2019-04-07 15:01

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

查看更多
登录 后发表回答