Select to view content in your preferred language

communication between client side   map with sqlserver database table

1189
8
12-07-2012 07:31 AM
gumpenagopikrishna
Emerging Contributor
please provide solution for this
0 Kudos
8 Replies
BillDaigle
Frequent Contributor
You won't be able to connect directly to the SQL database using javascript.  You will need to use some server side code to make the table information available as a web service.  There are a number of ways to do this.  If you have access an ArcGIS server, you could create a published python geoprocessing service that queries a SQL server table and returns the table, then use javascript to execute the service and make the data available to the cilent.  At ArcGIS Server 10+, you may also be able to access be able to access a table as part of a map service.  We are still on 9.3.1, so I can't say for sure.
0 Kudos
gumpenagopikrishna
Emerging Contributor
You won't be able to connect directly to the SQL database using javascript.  You will need to use some server side code to make the table information available as a web service.  There are a number of ways to do this.  If you have access an ArcGIS server, you could create a published python geoprocessing service that queries a SQL server table and returns the table, then use javascript to execute the service and make the data available to the cilent.  At ArcGIS Server 10+, you may also be able to access be able to access a table as part of a map service.  We are still on 9.3.1, so I can't say for sure.



Is there any api for this service and viceversa....please provide that link to me....
0 Kudos
JohnnyPenet
Emerging Contributor
The usual way to handle a demand of accessing a SQL server outside ArcGis server is to write a REST service at a web server that will handle the request and returning data. In JavaScript you can easily consume such a request by code like this base on JQuery

            $.ajax({
                cache: false,
                type: "POST",
                async: false,
                url: �??rest service url�?�,
                crossDomain: true,
                data: JSON.stringify(data),
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                processdata: true,
                success: function (data) {
                    if (!status)
                        alert("data retrieve failed");
       else
          �?�.. data handling
                },
                error: function (xhr) {
                    alert(xhr.responseText);
                }
            });

Writing REST services is not an ArcGis API issue, but pure writing web services. Currently I am writing a custom graphic layer class that will consume non ArcSDE geometry tables like the SQLGeometry of MS SQL server.  I hope later to make the code available. The REST service is written using .NET
0 Kudos
gumpenagopikrishna
Emerging Contributor
The usual way to handle a demand of accessing a SQL server outside ArcGis server is to write a REST service at a web server that will handle the request and returning data. In JavaScript you can easily consume such a request by code like this base on JQuery

            $.ajax({
                cache: false,
                type: "POST",
                async: false,
                url: �??rest service url�?�,
                crossDomain: true,
                data: JSON.stringify(data),
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                processdata: true,
                success: function (data) {
                    if (!status)
                        alert("data retrieve failed");
       else
          �?�.. data handling
                },
                error: function (xhr) {
                    alert(xhr.responseText);
                }
            });

Writing REST services is not an ArcGis API issue, but pure writing web services. Currently I am writing a custom graphic layer class that will consume non ArcSDE geometry tables like the SQLGeometry of MS SQL server.  I hope later to make the code available. The REST service is written using .NET



is this fine,but in this request what url i have to be placed.this is sqlserver query purose na
0 Kudos
SunilPalkar
Deactivated User
Hello
Best way is that (if you are using ArcGIS DT 10.0 and Server 10.0)

1.Create query layer in ArcMap ( click here)
is this fine,but in this request what url i have to be placed.this is sqlserver query purose na


2.Publish as map service in ArcGIS Server..

3.Use REST service for query in java script API.. It will resolve your issue ( Check query task in AGS_JSAPI) all the best : )
0 Kudos
gumpenagopikrishna
Emerging Contributor
Hello
Best way is that (if you are using ArcGIS DT 10.0 and Server 10.0)

1.Create query layer in ArcMap ( click here)


2.Publish as map service in ArcGIS Server..

3.Use REST service for query in java script API.. It will resolve your issue ( Check query task in AGS_JSAPI) all the best : )





I know rest service with url,but with out that service url how can i communicate sqlserver table with front end map.........i want connections in programming side from sqlserver to client side map.that map is tiled or dynamic......
0 Kudos
gumpenagopikrishna
Emerging Contributor
I know rest service with url,but with out that service url how can i communicate sqlserver table with front end map.........i want connections in programming side from sqlserver to client side map.that map is tiled or dynamic......


I know connections of sqlserver table data to bing map,but is it possible for tiled map........
0 Kudos
DevonDunham1
Deactivated User
One way is to use Postgres. It has support for GIS tables that will allow you to work better.
0 Kudos