using sql server in flex

2613
6
12-17-2014 05:55 AM
NasifAlshaier
New Contributor

does anyone has an example of using SQL server in Flexviewer?

thanks

0 Kudos
6 Replies
AnthonyGiles
Frequent Contributor

Nasif,

What do you mean by using SQL server in Flex, are you talking about an enterprise geodatabase held in SQL, being served through ArcGIS Server?

Please expand on your question

Regards

Anthony

0 Kudos
NasifAlshaier
New Contributor

hi Anthony

I am using Flexviewer. I have a mapserver  for a layer. I want my users when they click on a point to be able to retrieve data from a SQL table that is in my SQL server database.

Thanks

.

0 Kudos
AnthonyGiles
Frequent Contributor

When you say you have a layer from a mapserver is this an ArcGIS server? and have you configured your flex viewer to look at the REST endpoint, it will be something like this in your main config:

<layer label="Demographics" type="dynamic" visible="false" alpha="0.5" url="http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Household_Income/MapServ...">

If so you can configure your viewer to make use of pop ups, see the help here:

ArcGIS Viewer for Flex

If you are not using the REST endpoint and your layer is coming from a WMS there is currently no capability in the flex viewer to see the attributes (getFeatureInfo has not been implemented)

0 Kudos
ReneRubalcava
Frequent Contributor

If I understand you correctly, you want to query SQL DB data based on a selection from a layer. I don't do much active Flex development, but I still maintain a large Flex app and build/update services for it.

I'd say you have a few options.

1. Related Records *

You can add the SQL tables to the original MXD and publish them with service as related records you can query.

2. WSDL

A WSDL is cheap and dirty, but works pretty good with Flex apps.

3. Create a REST API for SQL DB

You can write a vanailla REST API that access your SQL DB data. Lots of resources on the web and this forum on how to do this.

4. RemoteObjects

This one is a little trickier, but is a classic when building services that communicate with Flex apps. Not fully recommended these days, I don't think, but still effective.

* I would recommend using Related Records with a Flex app. No extra fuss getting things up and running. Unless you need a more complex query or do things like JOINS of tables, this is probably the easiest method.

0 Kudos
LiYao
by
New Contributor III

Are you talking about flex connect to sql server DB? flex cannot directly connect to sql server DB, it need through some web server.

I follow the link below, it works:

http://www.codeproject.com/Articles/37649/Flex-Communication-with-ASP-NET-WebService

Good luck.

0 Kudos
NasifAlshaier
New Contributor

Thank you all for the help.. I got very good idea on what to do.

Regards,

Nasif Alshaier

Computer Services Manager

305-375-2775 Phone * 305-375-4940 Fax

"Delivering Excellence Every Day"

0 Kudos