This content has been marked as final. Show 5 replies
I think you will need to install flex data services; make a Java project using flex builder; then create an <mx:remoteObject> object which will interact with ordinary Java classes that do all the database connectivity issue.
Flex Data Services is not necessary for connecting to a database. You can use HTTPService calls to PHP or other scripting language such as .net to connect to a database of your choice. You can also use remoting with AMFPHP which is free and quite easy and efficient to work with. I use Flex/PHP/MySql all the time and they work great together.
Thanks you both for the advice. Do you think you might be able to explain
what the difference between using HTTPService calls to PHP vs. Remoting with AMFPHP?
Also, will it ever be possible to handle database connectivity using just the Flex SDK? E.g. something
like the mysql_connect function for PHP. I'm sure there is a reason why it's not feasible to have something like that right now, but I haven't come across any discussion on the topic. Thanks again for the feedback.
I think the reason Flex doesn't have it's own 'mysql_connect' is that *.SWFs are executed on the clients computer. The DBMS is running on a server - for example at your webhost. Access to the DBMS is most of the time restricted to localhost or certain trusted IPs or domains (security) and furthermore the client running your application would have to have a database-driver installed to communicate with the DB-server.
HTTPService calls send and receive data in String format, often as XML. Remoting uses the AMF3 format which is binary and thus much more compact for large data sets. If you are just transmitting a few records from you DB, then you probably won't notice a difference between the two approaches. In terms of programming, remoting is generally more efficient since you can send value objects and database results directly back to Flex and use the result without having to convert it since AMFPHP takes care of all the serialization for you. This speeds up development for me. However, if you are worried about having to install AMFPHP on the server, then HTTPService is a more generic way to go. AMFPHP is quite easy to setup, though.