Skip to content

mssql ConnectionError #20594

@sant123

Description

@sant123

Hi, I'm trying to run this code with mssql:

import sql from "npm:[email protected]";

const sqlConfig = {
  server: "localhost",
  user: "sa",
  password: "",
  database: "my_db",
  options: {
    trustServerCertificate: true,
  },
};

const pool = await sql.connect(sqlConfig);
const result = await pool.request().execute("spGetPurchases");

console.dir(result);

But I get Uncaught (in promise) ConnectionError: Failed to connect to localhost:1433 in 15000ms

image

I decided to do the same with Node v18.16.0 and worked perfectly:

const sql = require("mssql");

const sqlConfig = {
  server: "localhost",
  user: "sa",
  password: "",
  database: "my_db",
  options: {
    trustServerCertificate: true,
  },
};

(async () => {
  const pool = await sql.connect(sqlConfig);
  const result2 = await pool.request().execute("spGetPurchases");

  console.dir(result2);
})();

image

The SQL Server is running inside a Docker container:

image

I'm using Deno latest version as of today v1.37.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctlynode APIRelated to various "node:*" modules APIsnode compat

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions