0

I'm trying to learn web programming and I don't know what I need to do.

What I'm trying to do: download data from a 3rd party website and load it into my own private SQL database.

What I've done so far: I'm working in visual studio 2017, I've got a console JavaScript project that gets the data via https request. I've also got a SQL server project working with a table ready to receive the data. I can make entries by manually doing an insert query using the visual studio interface.

What do I do next? How do I get the SQL server to listen for insert requests from an app? How do I get the data(simple arrays of numbers with no json or xml labels) from the JavaScript app to the sql server?

Once I get the JavaScript app and the server talking to eachother, can I take the next step and just have the sql server make the https requests directly?

jarlh
  • 42,561
  • 8
  • 45
  • 63
FriendlyUser3
  • 45
  • 1
  • 4
  • You need a server-side language to handle communication from your Javascript and your database. C#/VB, PHP, Python, Node. etc – WillardSolutions Nov 16 '17 at 20:55
  • Maybe this helps: https://stackoverflow.com/questions/41477386/sql-server-connection-to-node-js – Ruud Helderman Nov 16 '17 at 21:02
  • Since you have VS installed, might as well create a C# MVC app? Your javascript from the client will then connect to the server (C# controller method) which will then do stuff (like any calculations) and then contact the database and save/update the data there. You won't contact the sql server directly from the client javascript. – nurdyguy Nov 16 '17 at 21:02

1 Answers1

0

Hoping that your are using nodejs application. First install mssql

 npm install mssql 

You can try something like this.

const sql = require('mssql')

async () => {
    try {
        const pool = await sql.connect('mssql://username:password@localhost/database')
        const result = await sql.query`insert into  ... // your query`
        console.dir(result)
    } catch (err) {
        // ... error checks
    }
}

If you are not using nodejs probably any language might have basic mysql connector which you could install and start using

Gaudam Thiyagarajan
  • 1,022
  • 9
  • 24