Query from browser

  • Hello,

    I suspect I already know the answer but it has been five years since I last did web coding so I'm not aware of new developments since then. Here is the scenario:

    We run a SQL Server database for our sheltering software that is in-house, behind the firewall. Our Intranet site is hosted on WordPress. A young co-worker who is working on a CIS degree thought it would be cool to incorporate some of the data in our database as part of a page on WordPress. She has written some javascript (with a fixed dataset) that uses a random generator to select names for animals new to our shelter. She is hoping to get a distinct list of animal names from our database when this page is hit so as new names are added, they can be included in the random selection. There are times when we have enough new animals in a day that folks run out of ideas for new names. Essentially, someone will hit the page on the Intranet (WordPress) and have an applet on the page that will get the data and provide the random selection.

    My understanding of javascript is that it would not be able to access anything outside the sandbox in the browser. All of my coding was server-side which won't work in this case. As of today, a SELECT DISTINCT is only returning just a little over 75,000 rows and she wants to do the work on "her side" so all I'm doing is providing the raw data.

    Anyone have any ideas how to make this happen?

  • jim.powers - Thursday, November 8, 2018 1:45 PM

    Hello,

    I suspect I already know the answer but it has been five years since I last did web coding so I'm not aware of new developments since then. Here is the scenario:

    We run a SQL Server database for our sheltering software that is in-house, behind the firewall. Our Intranet site is hosted on WordPress. A young co-worker who is working on a CIS degree thought it would be cool to incorporate some of the data in our database as part of a page on WordPress. She has written some javascript (with a fixed dataset) that uses a random generator to select names for animals new to our shelter. She is hoping to get a distinct list of animal names from our database when this page is hit so as new names are added, they can be included in the random selection. There are times when we have enough new animals in a day that folks run out of ideas for new names. Essentially, someone will hit the page on the Intranet (WordPress) and have an applet on the page that will get the data and provide the random selection.

    My understanding of javascript is that it would not be able to access anything outside the sandbox in the browser. All of my coding was server-side which won't work in this case. As of today, a SELECT DISTINCT is only returning just a little over 75,000 rows and she wants to do the work on "her side" so all I'm doing is providing the raw data.

    Anyone have any ideas how to make this happen?

    Write a Web API she can call using JavaScript.  She will get JSON formatted results back that she can work with in her JavaScript.
    https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-2.1

  • Your biggest issue here is the network path from a web-facing server across the firewall to your internal network.   Having a port opened there is a risky thing, and network security teams need to assess exactly what protocols will become functional through such an opening.   You might actually get turned down, in which case you may have to sneaker-net a flat-file that can be imported on the web server and then fetched from the JavaScript.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply