Accessing PostgreSQL data from Flash / Flex Builder using Coldfusion
Copy link to clipboard
Copied
Hello,
I am relatively new to Flash Builder. I don't know anything about Coldfusion. I want to access to a PostgreSQL database for an application. I made some searches, and it seemed like I needed a connector like Coldfusion to access to PostgreSQL from Flash / Flex builder.
I installed Coldfusion 9, added a PostGreSQL connection using Data & Services > Data Sources using ColdFusion Administrator. Then I wanted to see if the connection was working. I started Flash Builder, created a new project. Under Data/Services, I selected Connect to Data/Service. Here, it asked me to select a CFC file. Since I did not think I had created one, I clicked on "click here to generate a sample".
When I clicked on "Generate from RDS datasource, I am prompted with an authentication windows. I supposed my RDS username and password would be same as the Coldfusion login, "admin" and password. When I clicked OK on this authentication window, I get an RDS error:
"The following error occurred while getting datasource details. Check your RDS server and datasource settings and try again.
Error executing RDS command. Status code : 404 , Reason : Not found"
If I select "Generate from template" option in "Generate Sample CFC Service" window, it makes some sort of connection I guess, but I don't see any data that I have in my PostgreSQL database.
Can you explain me how I can fix this problem. I just want to access my PostgreSQL database.
Thanks
Naci
Copy link to clipboard
Copied
It might be easier to by pass the Flex|Flash part of this equation at this time.
Flex|Flash does not make direct connections to back end data sources as you are learning. It works through some type of middleware tool such as ColdFusion.
You basically write ColdFusion database CRUD|ORM|API code that is what you connect to Flex. That is what the Generate Sample CFC wizard was trying to provide for you.
Just to see your DSN working though you can get much simplier then that.
Simply write a basic SQL statement to select some data, put it inside of a <cfquery...> tag, add a <cfdump...> to see the returned data and save this as a text file with an .cfm extension on your web server under the web root directory. Then call the file with a browser. It could look something like this.
testDSN.cfm
<cfquery datasource="myPostGreSQLDSN" name="testing">
SELECT aField,bField,cFieldFROM aTable
</cfquery>
<cfdump var="#testing#">
And then run from a browser with: http://localhost/testDSN.cfm
After that, if you care to utilize the wizards, we can attempt to reslove your RDS problems. Or you can ignore them and create your API code with oher means and connect to them with your Flex Code.
Copy link to clipboard
Copied
Ian,
Thanks for your answer.
I am confused though why Flash Builder could not develop the CFM file. I saw a tutorial online: http://anirudhs.chaosnet.org/blog/2009.10.07.html
Since the "Generate Sample CFC wizard" wizard is supposed to work according to the tutorial, I wonder what I am missing. Because I have this issue, I have a feeling it still won't work even if I create the CFM file myself.
What do you think?
Thanks
Copy link to clipboard
Copied
Naci,
I didn't answer you in the Expert site because you seem to be flooding this question all over the place. Try to stick with one place to ask questions unless that place can't answer it. No sense in answering your question in multiple places.
Copy link to clipboard
Copied
Yes, it should work if you have RDS properly configured. Trouble shooting RDS problems can be rather an hair pulling excersise so I concentrated on what I read as the most important part of your original post.
I'm not particulary good at figuring out RDS issues. I've had them in the past, usually manage to get them resolved with lots of searching, blood and tears. Then it works for the next three years until I update my system and|or software. During which I forget what solutions I found way back then.
One of the easiest things to do is to check in the ColdFusion Administrator under the "Security" tab and make sure you have RDS enabled.
Copy link to clipboard
Copied
Well, looking at that tutorial, I think I enabled RDS modifying the web.xml file under [coldfusiondirectory]/wwwroot. I did not see any options to enable RDS in Coldfusion administrator though. I can only change the RDS password there.
A question though, what is the RDS user name for the RDS authentication. I was assuming it would be "admin", but could I be wrong?
Thanks
Copy link to clipboard
Copied
Well it could be anything if you set something during the installation process.
The easiest thing would just reset it to something you know with the Administrator form.
Just as long as there are no other users connecting with RDS, 🙂 This shouldn't hurt anything.
Copy link to clipboard
Copied
Thanks, how do I reset it?
Naci
Copy link to clipboard
Copied
Just complete the RDS login form on the Administrator page you mentioned before.
Copy link to clipboard
Copied
dastistfackt: I suppose the web resourse u promote is ColdFusion powered.
Copy link to clipboard
Copied
dastistfackt: I suppose the web resourse u promote is ColdFusion powered.
Just a tip... click the "report abuse" and file a spam report for these sort of posts...
--
Adam

