Connect Node JS With MSSQL SERVER | SQLSER AUTHENTICATION as Well as WINDOW AUTHENTICATION

Поділитися
Вставка
  • Опубліковано 19 сер 2024
  • NOTE :
    - npm install mssql --save (to install mssql )
    - npm install msnodesqlv8 --save (to install driver)
    --------------------------------------------------------------------------------------
    2ndcode.pawank...
    Thanks for watching this video .
    Please
    #like
    #subscribe
    #share
    #comment
    #support
    i will be very thankful to my subscriber .

КОМЕНТАРІ • 83

  • @2ndcode263
    @2ndcode263  Рік тому +4

    2ndcode.pawankumarsah.com.np/2022/11/25/connect-node-js-in-mssqlserver/

  • @abhaya0134
    @abhaya0134 8 місяців тому +3

    You showed me a solution in 10mins which I couldn't figure out for days 😂. Thanks alot!

  • @ketanpardeshi
    @ketanpardeshi 19 днів тому

    Bro. You save my time. Thanks a lot. Straight forward and to the point video. :) Keep it up

  • @JosephMonreal-nr9tu
    @JosephMonreal-nr9tu 3 місяці тому +2

    Just what I needed. Thank you sir!

  • @vinster-ti9ve
    @vinster-ti9ve 5 місяців тому +1

    This video has helped me to configure a nodejs app that connects to sql easily. Thank you so much!!! God bless you..

  • @The.SpiritualScientist
    @The.SpiritualScientist Рік тому +2

    Brilliant video bro. It is found super helpful. Thanks for posting. Keep doing the great work.

  • @vitavit1827
    @vitavit1827 7 місяців тому +1

    thank you. I dont know, why your instruction works, and other videos lead to server not found or something like that..

  • @sarangane7005
    @sarangane7005 Рік тому +4

    Thanks a lot ..it worked for me

  • @rcasturi55
    @rcasturi55 8 місяців тому +1

    Great Thanks So much .

  • @Isak47410
    @Isak47410 11 місяців тому +1

    I love you man, amazing tutorial

  • @PaulSelvi-cl4gr
    @PaulSelvi-cl4gr 10 місяців тому +1

    Excellent

  • @armjim1412
    @armjim1412 Рік тому +1

    This is great, actually worked

  • @vinaya6864
    @vinaya6864 Рік тому +2

    thank you very much sir

  • @truyentranhm4v900
    @truyentranhm4v900 Рік тому +3

    Thank you very much, i love you

    • @2ndcode263
      @2ndcode263  Рік тому +1

      You're welcome!, Love you too

  • @pshibby77
    @pshibby77 3 місяці тому +1

    thanks

  • @20_omkar_kadu57
    @20_omkar_kadu57 11 місяців тому +3

    ConnectionError: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    plz make a video on this

    • @diegoalzugaray6229
      @diegoalzugaray6229 8 місяців тому

      Have you found a fix to this?

    • @muruganamirthalingam6023
      @muruganamirthalingam6023 6 місяців тому

      I have the same issue. Please help me with this.

    • @saiabhilash3151
      @saiabhilash3151 5 місяців тому

      1.Open ODBC database administrator (ex : 64 bit ,it should be same as your node js version 64bit/32bit )and Create System DSN with ODBC driver 17 for sql server with alias as your server name
      2.Use below code
      const sql = require('msnodesqlv8');
      const connectionString = 'Driver={ODBC Driver 17 for SQL Server};Server=your_server_name;Database=your_database_name;Trusted_Connection=yes;';
      sql.open(connectionString, (err, conn) => {
      if (err) {
      console.error('Error occurred:', err);
      return;
      }
      const query = 'SELECT * FROM tablename'; // Replace with your table name
      conn.query(query, (err, results) => {
      if (err) {
      console.error('Error executing query:', err);
      } else {
      console.log(results);
      }
      conn.close();
      });
      });

    • @benlahcensoufiane1589
      @benlahcensoufiane1589 4 місяці тому

      sameeee

    • @atle5153
      @atle5153 3 місяці тому

      @@muruganamirthalingam6023 after hours searching, i finally fix it. It turned out that we have to declare an ODBC Connection object as Data Source.
      Go to Control Panel -> Admins Tool-> ODBC Data Source Administrator. Then In Tab System DSN, Click Add.
      Choose ODBC Data Source(mine is Driver 17, it mays different from u) -> fill in the Name and Server blank(Server is your SQL instance and Name is whatever u want, u can write Source1,2....) -> Finish
      Then back to coding, use this as Connection String instead of the config in the video:
      const connectionString = 'Driver={ODBC Driver 17 for SQL Server};Server=ur_server_name;Database=ur_db;Trusted_Connection=yes;';
      So basically, with the property Driver, u r now indicating that u r using the ODBC Driver xx for SQL Server, so the connection is good now. Hope it helps

  • @user-be4nz1rq5g
    @user-be4nz1rq5g 7 місяців тому +1

    sorvor

  • @buiminh461
    @buiminh461 2 місяці тому

    hey man, i have this error: "ConnectionError: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified". How to fix this?

  • @saharait7782
    @saharait7782 Рік тому +1

    Thank you very much

  • @tienphanmemtinh8207
    @tienphanmemtinh8207 5 місяців тому

    Do you have an example of Login React Native connecting to sql server, reading, writing, deleting, saving... and outputting to gridview ?

  • @davidkuti362
    @davidkuti362 Рік тому +1

    Thanks 😊😊😊

  • @digitronix532
    @digitronix532 Місяць тому

    How to add data to MS SQL Server 2012 Using Node ?

  • @joysamuelkamlomo8684
    @joysamuelkamlomo8684 10 місяців тому +1

    how can you do this with an ORM like prisma?

  • @SAKBA9
    @SAKBA9 11 місяців тому +1

    Thanks for good knowledge.
    Do you have a way show data in TERMINAL on HTML?

  • @mayankgupta-bw3nt
    @mayankgupta-bw3nt Рік тому +1

    thanks

  • @Aditi67885
    @Aditi67885 Рік тому +1

    Thank you very much it's also work for me , can u just tell me how to display this data in web page

  • @rcasturi55
    @rcasturi55 Рік тому

    Thanks you are good

  • @ravirajug1137
    @ravirajug1137 4 місяці тому

    how to return these results as variable

  • @joangeorgiev4895
    @joangeorgiev4895 7 місяців тому +1

    Error: Cannot find module 'msqsql/msnodesqlv8' ---- i wrote everything correctly, what do i do

  • @witchakornsittipong1418
    @witchakornsittipong1418 Рік тому +2

    hi, can this technique use with online DB?

  • @user-ss8lk3tx2c
    @user-ss8lk3tx2c 6 місяців тому

    How should I input the url/path if the database is on another server? (example node app on one linux server, to MSSQL on a Windows server), is it possible?

  • @mohammedasif9525
    @mohammedasif9525 Рік тому +1

    Hi There I am getting an error while running a query code: 'EREQUEST',
    originalError: [Error: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid object name while I get valid output when I run the query on Ms SQL server management studio. Is there a way we can connect on this

  • @dhananjaydhoke3735
    @dhananjaydhoke3735 Рік тому +1

    [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified I have try lot of things still getting this error please help me

    • @2ndcode263
      @2ndcode263  Рік тому

      2ndcode.pawankumarsah.com.np/2023/05/27/microsoftodbc-driver-manager-data-source-name-not-found-and-no-default-driver-specified/

    • @basit3358
      @basit3358 11 місяців тому

      Hey! Did you find out anything about this error.? I am getting this same error too.

    • @dhananjaydhoke3735
      @dhananjaydhoke3735 11 місяців тому

      @@basit3358 not bro

  • @xangmarques
    @xangmarques Рік тому +2

    muito bom

  • @juanjesusgomezperez8669
    @juanjesusgomezperez8669 9 місяців тому +1

    could i use this to conect a web application that is conected to mysql and migrate to SQL SERVER?

  • @adila4658
    @adila4658 Рік тому +1

    This maybe a stupid question but I want to connect to my live sql server from my localhost would I put for server:sql ip address?

    • @2ndcode263
      @2ndcode263  Рік тому

      sorry i am late to reply . But i didn't understand what you actually want to do . you can inbox me here www.linkedin.com/in/pawan-kumar-6a5994128/

  • @ImaginativeWork
    @ImaginativeWork 8 місяців тому

    How do I deploy this to an IIS Server?

  • @mogheshantanu
    @mogheshantanu Рік тому +1

    bro is hitting enter like there's no tomorrow

    • @2ndcode263
      @2ndcode263  Рік тому +1

      Live in Present . Never Worry for Tomorrow

  • @Blackjac
    @Blackjac 3 місяці тому

    Which version ubuntu were you using on this?

  • @nijiln8823
    @nijiln8823 3 місяці тому +1

    What is your Node version?

  • @user-ib9qz7tt8w
    @user-ib9qz7tt8w 8 місяців тому

    Hi, I am getting an error like no Connection was made .. I tried for SQLSER authentication.. Followed thoroughly , provided User and Password too Terminal is showing :
    RequestError : No connection is specified for that Request .

    • @pa3etka
      @pa3etka 8 місяців тому

      Have you found a solution?

    • @Cricket_Ai
      @Cricket_Ai 6 місяців тому

      have you@@pa3etka

  • @user-sr3il7uo2j
    @user-sr3il7uo2j 6 місяців тому

    Hi I tried as you mentioned and ran the js file. I'm getting this error:
    ConnectionError: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    When i checked solution for this error online it shows that i need to specify the driver in ODBC Data Source Administrator. But we didn't download any driver so how can i specify it? Please help!

    • @Cricket_Ai
      @Cricket_Ai 6 місяців тому

      you resolved this?

    • @user-sr3il7uo2j
      @user-sr3il7uo2j 6 місяців тому

      @@Cricket_AiNo I had to move into different db

    • @saiabhilash3151
      @saiabhilash3151 5 місяців тому +3

      1.Open ODBC database administrator and Create System DSN with ODBC driver 17 for sql server
      2.Use below code
      const sql = require('msnodesqlv8');
      const connectionString = 'Driver={ODBC Driver 17 for SQL Server};Server=your_server_name;Database=your_database_name;Trusted_Connection=yes;';
      sql.open(connectionString, (err, conn) => {
      if (err) {
      console.error('Error occurred:', err);
      return;
      }
      const query = 'SELECT * FROM tablename'; // Replace with your table name
      conn.query(query, (err, results) => {
      if (err) {
      console.error('Error executing query:', err);
      } else {
      console.log(results);
      }
      conn.close();
      });
      });

    • @vinster-ti9ve
      @vinster-ti9ve 5 місяців тому +2

      @@saiabhilash3151 Thanks so much!!! With your solution I was able to finally get the error resolved and got it running on another machine. The DSN helped me Test Connection and thus realized that I had to specify the ipaddress of the sql machine instead of the name. Worked like a charm!!! 🙏

    • @saiabhilash3151
      @saiabhilash3151 5 місяців тому

      @@vinster-ti9ve All Thanks to chat gpt for providing solution 😉

  • @melakusisay9881
    @melakusisay9881 Рік тому

    const sql=require("mssql/msnodesqlv8");
    which folder is mssql i didn't understood it please brief ans on it

    • @2ndcode263
      @2ndcode263  Рік тому

      may be now it was updated . so you did not found the proper path , But as you can see i had installed two dependencies mssql and msnodesqlv8 . please check the updated code on the official npm js website

  • @veenaanto7851
    @veenaanto7851 Рік тому

    Any leads on how to connect with sql server db using Authentication Azure Active Directory - Universal with MFA

    • @2ndcode263
      @2ndcode263  Рік тому

      try the below code :
      ///////////////////////////////////////////////////////////////
      const sql = require('mssql');
      const config = {
      server: 'your-server-name.database.windows.net',
      database: 'your-database-name',
      authentication: {
      type: 'azure-active-directory-access-token',
      options: {
      token: '',
      },
      },
      options: {
      encrypt: true,
      },
      };

  • @AshokKumar-kn4dl
    @AshokKumar-kn4dl Рік тому

    hello Sir I am Getting This error Invalid object name 'WtAshok'

    • @2ndcode263
      @2ndcode263  Рік тому

      can you please share your code here www.linkedin.com/in/pawan-kumar-6a5994128/

  • @rcasturi55
    @rcasturi55 Рік тому

    When you close the db conn?

    • @2ndcode263
      @2ndcode263  Рік тому

      i had not closed but you can close at the end