Select to view content in your preferred language

Write a SQL Select Statement in Flex

2890
8
04-14-2010 01:01 PM
BrentKastor
New Contributor
Hello,

I am looking to write a SQL Select Statement to populate a text field in my flex project.  I am running into some difficulties.  I want to select data from a SQL 2005 database using a variable that gets returned from a map click event.  Do I need to set up a connection to the SQL Server database first?  I found some Flex documentation, but it was not clear to me.  Any help would be greatly appreciated.  Thanks!

Brent Kastor
Coweta County, GA GIS
Tags (2)
0 Kudos
8 Replies
DasaPaddock
Esri Regular Contributor
You'll need to create a web service on your server that accesses your database and returns the data you want. There are many ways this can be done. If the payload is small, then I'd recommend implementing it in whatever way you're most comfortable with.

See here from more info:
http://livedocs.adobe.com/flex/3/html/data_intro_2.html#188004
0 Kudos
NasifAlshaier
New Contributor
Hi Brent...
were you able to implement the SQL select/populate? if so, can you share your steps.?
Thanks
Nasif
0 Kudos
ZahidChaudhry
Occasional Contributor III
You have to use some sort of server side scripting easiest one to implement is PHP and especially Zend framework. if you hav php running on your machine. FlEX directly connect to SQL and writes all the codes for you using AMF which is very fast and robust and you do not need to publish the data as map service. I am using this technique to fetch data out of oracle and then create a dynamic graphics layer. I have to write all php script as FLEX only support SQL server...
But it is very easy and simple. if not you can use .NET web services to do the same thing...
0 Kudos
NasifAlshaier
New Contributor
Thanks  for the posting.. can you share you code?
0 Kudos
ZahidChaudhry
Occasional Contributor III
Thanks  for the posting.. can you share you code?

Here is a link to a video, that will explain step by step process to conncet to SQL server using php and FLEX

I hope it will help
0 Kudos
NasifAlshaier
New Contributor
Hi..

I did not see any link to the video...Can you pls re-post it.
Thanks in advance
0 Kudos
ZahidChaudhry
Occasional Contributor III
0 Kudos
EricPaitz
Esri Contributor
The approach we have used was to create some server side java code that connects and queries the database. This java code is called via a Remote Object call from Flex. The Flex to Java connection is made using BlazeDS. This book was a great way to get started.

http://www.amazon.com/Enterprise-Flex-Blazeds-Tutorial-Approach/dp/1440495661

From the flex side its just like calling the Query and QueryTask objects from the ArcGIS Flex API.
0 Kudos