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