If you are using Flex Builder try using the HTTPService to connect to a database using a server-side language such as php
1 person found this helpful
Here are some great links showing how to connect to MySQL using PHP:
If this post answered your question or helped, please mark it as such.
It'll be very good solution if I have Flex, but I'm using Adobe Flash CS4, but I will see this webpages.
Have you got any ideas for Flash?
Really nobody knows how do it? It's very important for me.
Second time - refresh. Guys, what's with you?
I think that, it is what I'm loking for. I don't understand one thing:
mysql_pconnect ( "HOST OF YOUR SQL SERVER" , "YOUR SQL USERNAME" , "YOUR PASSWORD" )
What I must put in HOST OF YOUR SQL SERVER? http://myserver.com?
Are you trying to connect to a MySQL database on a web server somewhere? If so, by far the easiest way to do so is to use some sort of application server layer (e.g. PHP, ColdFusion, Java) on the web server, and have the AIR application call the PHP (or whatever) code to get the data. That is the approach that all the links Greg has given you are talking about.
Of course, in order to make that work you need to know enough PHP/Java/ColdFusion to write that middle layer. In the example you're asking about, the information it wants to know is the name of the server that the MySQL database is running on, and the MySQL username and password for the MySQL account that your PHP code is supposed to use. There are tons of resources on the web for writing PHP code that accesses MySQL, so you'll find much more and better information in other places than what you'll find in the Adobe AIR forums.
However, maybe you want to have the MySQL server running directly on the user's computer rather than on a web server somewhere. In that case you would have a few options:
- Run a web server and application server (e.g. Apache and PHP) on the user's computer and use those to connect between the AIR application and the MySQL server.
- Write Java code to communicate between the MySQL server and the AIR app, and call that code using Merapi (http://merapiproject.net/)
- Run the MySQL server on the user's computer and call the server directly from AIR using ActionScript. While there is no built-in support for MySQL in AIR, there is a third-party (open source) library for calling MySQL directly from ActionScript available here: http://code.google.com/p/assql/. I haven't tested it so I have no idea how complete it is, but it's a solution to consider.
However, in all three cases you're depending on some external pieces that have to be installed and loaded separate from your AIR application. (For instance, most users probably don't want a MySQL server running on their computer all the time if they aren't using your AIR app all the time -- so you'd want a way to start and stop the server, which also couldn't be done directly in AIR.) People do write applications that use external resources like this, but it's not the easiest thing to implement.
If you're really wanting to run the database locally, the best solution (assuming it works for your needs) is to use AIR's built in local SQL database engine (based on SQLite). If you've looked at that option already, and found that it doesn't work for you, I'd be interested to know more about what you're trying to accomplish that you can't accomplish with the AIR local database.
Long answer I'll use AMFPHP to connect MySQL database "somewhere". But I don't understand this code - I know PHP enough to write this service, but I don't know what write there.
Can you help me?
I would mark this answer as "helpful", If I had it more. Thanks