This might sound weird but due to cost and architectural constraints, I need to explore whether it is possible for an ArcGIS API for JavaScript web app to connect directly to a Microsoft SQL database to display (and render) geometries on the web app? In another words, no ArcGIS for Server is involved here - just JavaScript to SQL database. I don't believe this can be achieved.
JavaScript cannot connect directly to database server you need a middle layer (Web Service) between them
You will at least need a server-side page (PHP/ASP) to handle the database connect request. Then you just call the server-side page with an esri.request or AJAX call to retrieve the database query results.
What geometries do you have in the database? You should be able to construct graphic layer geometries from it in some way.
This approach might work for us. We could retrieve the geometries and attributes and construct graphic layers from them. We have points and polygons to display. I think the polygons could be multi-part polygons.
You will want to fully read and understand if you are compliant with esri Terms of Use:
If your web server is IIS, I would create a REST endpoint using ASP.NET Web API. The SQL query would occur here, on the web server, and return the query result as JSON. Your client-side code (JavaScript) would call this REST endpoint and convert the results into features.
The ArcGIS API for JavaScript is not your only option for creating an interactive map. Leaflet is another alternative you might want to consider. If you go with Leaflet, you'll want your server-side code to return the data from SQL as GeoJSON.