<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unsuccessful connect to SQL Endpoint using Node.js and tedious or mssql npm package in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Unsuccessful-connect-to-SQL-Endpoint-using-Node-js-and-tedious/m-p/3749879#M50213</link>
    <description>&lt;P&gt;that "socket hang up"&amp;nbsp; seems to be a rather popular error message lately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a Pro license you can open a Pro ticket at &lt;A href="https://admin.powerplatform.microsoft.com/newsupportticket/powerbi" target="_blank"&gt;https://admin.powerplatform.microsoft.com/newsupportticket/powerbi&lt;/A&gt;&lt;BR /&gt;Otherwise you can raise an issue at &lt;A href="https://community.fabric.microsoft.com/t5/Issues/idb-p/Issues" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Issues/idb-p/Issues&lt;/A&gt; .&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2024 23:24:41 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-03-07T23:24:41Z</dc:date>
    <item>
      <title>Unsuccessful connect to SQL Endpoint using Node.js and tedious or mssql npm package</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Unsuccessful-connect-to-SQL-Endpoint-using-Node-js-and-tedious/m-p/3749319#M50194</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Software versions&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;tedious&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"^17.0.0"&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;Node.js:18.17.1&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var Connection = require("tedious").Connection;

var config = {
  server:
    //"****.datawarehouse.pbidedicated.windows.net",
    "*****.datawarehouse.fabric.microsoft.com",
  database: "Gold",
  options: {
    encrypt: true,
    trustServerCertificate: false,
  },
  authentication: {
    //type: "azure-active-directory-password",
    type: "azure-active-directory-service-principal-secret",
    options: {
      //userName: "@.onmicrosoft.com",
      //password: "****",
      clientId: "****",
      tenantId: "****",
      clientSecret: "****",
    },
  },
};

var connection = new Connection(config);

connection.connect((err) =&amp;gt; {
  if (err) {
    console.log("Connection Failed");
    throw err;
  }

  console.log("Custom connection Succeeded");
  connection.close();
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;STRONG&gt;Problem description&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Got an error message when connecting to Microsoft Fabric&amp;nbsp;SQL Endpoint&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;ConnectionError: Connection lost - socket hang up
     {at Connection.socketError
... node_modules\tedious\lib\connection.js:1344:26)
    code: 'ESOCKET'
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Note:that the connection works when using the powershell with the same parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Install-Module -Name SqlServer
$connectionString = "Server=$server;Database=$database;User Id=$username;Password=$password;Authentication=Active Directory Password;Encrypt=True;TrustServerCertificate=False;"
# Create a SQL connection
$sqlConnection = New-Object System.Data.SqlClient.SqlConnection
$sqlConnection.ConnectionString = $connectionString&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 16:37:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Unsuccessful-connect-to-SQL-Endpoint-using-Node-js-and-tedious/m-p/3749319#M50194</guid>
      <dc:creator>Omar_Osman</dc:creator>
      <dc:date>2024-03-07T16:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Unsuccessful connect to SQL Endpoint using Node.js and tedious or mssql npm package</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Unsuccessful-connect-to-SQL-Endpoint-using-Node-js-and-tedious/m-p/3749879#M50213</link>
      <description>&lt;P&gt;that "socket hang up"&amp;nbsp; seems to be a rather popular error message lately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a Pro license you can open a Pro ticket at &lt;A href="https://admin.powerplatform.microsoft.com/newsupportticket/powerbi" target="_blank"&gt;https://admin.powerplatform.microsoft.com/newsupportticket/powerbi&lt;/A&gt;&lt;BR /&gt;Otherwise you can raise an issue at &lt;A href="https://community.fabric.microsoft.com/t5/Issues/idb-p/Issues" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Issues/idb-p/Issues&lt;/A&gt; .&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 23:24:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Unsuccessful-connect-to-SQL-Endpoint-using-Node-js-and-tedious/m-p/3749879#M50213</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-07T23:24:41Z</dc:date>
    </item>
  </channel>
</rss>

