Skip to main content
Participating Frequently
January 15, 2009
Question

can't connect MySQL, Flex andCF8

  • January 15, 2009
  • 3 replies
  • 1331 views
I have installed CF8 and MySQL on Vista. I'm using Flex3 to build the application. I can't get Flex to see the database. In fact... I can't even find where to point Flex in the setting up of the SQL statements. I can't find the database files.

In CF, under Data & Services > Data Sources, I entered what I "think" is my database name without any directly path. I entered "TMMP" in the field. It resolved and says the database status is ok. But under C:\ColdFusion8\db there are no files called TMMP. I have data in the database so i know files are SOMEWHERE.

How can I set this up so I can use Flex to see my data files?
This topic has been closed for replies.

3 replies

Inspiring
January 15, 2009
It's important to keep in mind that MySQL databases are stored in the default location specified in MySQL, not ColdFusion. As cfSearching mentions, a CF Data Source is simply a connection between the ColdFusion web server and the MySQL database server. This connection enables ColdFusion to talk (execute SQL statements and return results) to your MySQL database.

To "see" your database in Flex Builder, be sure to install the ColdFusion Extensions for Eclipse/Flex Builder. One of these extensions is called RDS Dataview (Window-->Other Views...). You will need to configure the RDS connection in Flex Builder's preferences (and be sure that RDS is enabled in the ColdFusion Administration) so that it knows how to find your ColdFusion server.

Once configured, the RDS Dataview lists all data sources in your CF Administrator. In addition, the RDS Dataview allows you to "open" said data sources to reveal tables, columns, procedures, etc. With the help of a different CF Extension for Eclipse/Flex Builder, you can use the RDS Dataview to generate CFCs from a table in your data source -- simply right click on a table name in the RDS Dataview and select the option to generate the CFC(s).

Also note that Flex/Flex Builder does not actually "connect" to a database (well, an AIR application can connect to a local SQLite database but that's a whole other thing). Flex/Flex Builder makes its database connections through ColdFusion CFCs, which are invoked via the mx:RemoveObject tag bueche mentions, or via other server-side technologies (PHP, Ruby, WebOrb, etc.).

Ultimately, in a CF/Flex application, it is ColdFusion that does all the database work. When completed with a task, it is ColdFusion that sends the results of the database operation back to Flex, from which you can do all sorts of stuff in Flex!
Participant
January 15, 2009
Try looking at flexcf.com

When you create the flex project:
1. Change the project location to C:\ColdFusion8\wwwroot
2. For application server type choose cold fusion
3. Leave remote object access service checked
4. Check use LCDS services

Create the project.

Copy the mxml file, demo.mxml, from the simple remote object tutorial. Make sure you copy it from the copy and past tab. Copy this into YOUR MXML just highlight and replace yours. Save it.

Via flex builder create a new folder in your project called "components". Open a plain file (in flex builder). Copy and paste the DemoCFC.cfc file from there into this file and save it into components as Demo.cfc.

In your mxml file change the Source for the mx:RemoteObject to [whatever you named your project].components.Demo For instance same you named your project blah. Change the source to blah.components.Demo. i.e. source="blah.components.Demo"

Now run the program. Now work through the database examples with the default db's. When you get a couple of those working, substitute your database name as the datasource in the cfc file.

If you did this right you should see your blah directory under wwwroot in the cold fusion directory
Inspiring
January 15, 2009
I not very familiar with Flex myself. But have you read the documentation on data access?
http://livedocs.adobe.com/flex/3/html/data_intro_3.html

> I can't find the database files...
> In CF, under Data & Services > Data Sources ...
> But under C:\ColdFusion8\db there are no files called TMMP

As far as ColdFusion, creating a datasource does not mean "create a database". A datasource is just configuration information that tells ColdFusion how it can connect to an _existing_ database (ie Information like the database server IP, database username, password, etc...). So the database needs to exist first. What kind of database are you using?