This content has been marked as final. Show 7 replies
I logged a bug for this when I reproduced it 2nd and 3rd machines on different networks.
I have successfully connected to a MySQL DB from Flex Builder 3 using the same general approach you did, but with the following additoins:
1) you have to get your DB connection working. This will create a connection file in you Flex project folder with a name that end in xxxconn.php, and the contents will look something like: (The xxx is basically whatever you named that project).
* connection settings
* replace with your own hostname, database, username and password
$hostname_conn = "localhost";
$database_conn = "your_dbname";
$username_conn = "root";
$password_conn = "your_rootpassword";
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_query("SET NAMES 'utf8'");
This is your connection file, and is needed to connect to your DB.
Once this is accomplished, there are several additional steps you must follow. These are outline in this info that I found on the web. Here is the overall procedure:
To create a new Flex application that is connected to an online database:
Create a new Flex project.
Select PHP as the application server type.
Set the webroot folder, and the Root URL to your web root. (where your PHP files run from.)
Click on validate configuration. (This must be working)
Click on Finish.
In Flex Builder, select the Data menu, and then Create Application from Database…
Select the project you just created. (click on the xxx.mxml file in your new project)
Create a new database connection. Give it any name. Click next.
Enter the host URL, database name, username and password for your MySQL
installation. Click Test Connection to make sure everything is OK. (This also must be working)
Click Finish if it was OK.
Select the desired DB table name under table, and select the column key to use as the primary key. Click next.
Select the folder to put the generated PHP code (bin/ by default) and the file name for the
PHP source file).
Click next, where you can select what to show in the application. Click finish.
Right click on the generated .mxml file and select Run the application.
A file will open in you web browser, with access to the database table you set up in the connection settings.
This worked for me, after some effort.
It appears that the wizard cannot access the database server. Try pinging the server before using it in order to make sure that it is working properly. The database is on an internal server? Can it be access from outside? I tried pinging the db1368.perfora.net server but I didn't received any response.
I'll try that, and report back. But, the connection should still work as directed, and it doesn't.
I can go into Dreamweaver CS3, and create a connection to that machine and database just fine. It is not an internal machine. It is actually a webhosting company. I can use PHP to connect to it, just fine. Something isn't working correctly within Flex 3.
Can you find out the IP address of the database server and try again using the IP instead of server name?
Good idea, but how? This is a 3rd party webhosting company. The IP name is just a place holder (probably a redirect) to a machine. But, something isn't working that works in another Adobe product.
If you like, send me an email directly, and I will send you all the connection information that I have, including the DB name, user, and password. If this didn't work in Dreamweaver, I would suspect a set-up issue on my part. But, this works just fine. If need be, I can even set-up a webconference on my end, and show you directly how I can connect in DW CS3.
Let me know how to proceed. I am glad to help in anyway I can.