Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kade 4 posts 24 karma points
    Jul 17, 2023 @ 19:28
    Kade
    0

    A network-related or instance-specific error occurred while establishing a connection to SQL Server

    Hello,

    I am having database connection issue with my server, I double check the user and password, and I was able to login into the database, but the connection issue still occurs. I am using umbraco v12.

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

  • Simon Napper 115 posts 349 karma points
    Jul 18, 2023 @ 10:03
    Simon Napper
    0

    First up I would just double, double check that the server name in your connection string is correct. Especially if you're running everything on the same box, sometimes you need a "double barrelled" server name with something like SERVER\INSTANCENAME rather than just one or the other.

    What version of SQL are you using?

  • Kade 4 posts 24 karma points
    Jul 18, 2023 @ 13:21
    Kade
    0

    I am running it on Azure, and others env are working fine using the same pipeline. There is backslash in the password: xxxx\xxxx and I escape by doubling the backslash => xxxx\xxxx.

    Data Source=tcp:serverName.database.windows.net,1433;Initial Catalog=dbName;User Id=$(userName)@serverName.database.windows.net;Password=$(pwd);

  • Simon Napper 115 posts 349 karma points
    Jul 18, 2023 @ 13:49
    Simon Napper
    0

    Well it's difficult to say what the issue might be without knowing your Azure set up as this is most likely an Azure issue rather than Umbraco, but the named pipes error normally indicates that there is an issue with finding the server instance (so might be the wrong name, etc.) or a configuration issue either with allowing remote connections to the db or something like IP address restriction/firewall stopping the connection.

    When you say you can connect to the server, do you mean via SMSS from your local PC and is it from that same PC that you can't connect to it via Umbraco? Have you tried using Telnet/Powershell to connect to it from your target machine?

  • Kade 4 posts 24 karma points
    Jul 18, 2023 @ 14:05
    Kade
    0

    I can connect to the database from my local IP and also I could login into the db from the portal. And no I have not tried connecting using Telnet or Powershell.

    This is the connection string that I even tried using it: Server=tcp:serverName.database.windows.net,1433;Initial Catalog=dbName;Persist Security Info=False;User ID=userName;Password=myPWD;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Jul 18, 2023 @ 17:27
    Huw Reddick
    0

    looks like bits of your connection string may be incorrect, it should be something like

    Server=tcp:myserver.database.windows.net,1433;Database=myDataBase;User ID=mylogin@myserver;Password=myPassword;Trusted_Connection=False;Encrypt=True;
    
  • Simon Napper 115 posts 349 karma points
    Jul 19, 2023 @ 11:14
    Simon Napper
    0

    I wondered the same thing and out of curiosity tried the old format with an Azure connection and it did work (which I must admit did surprise me...!)

  • Simon Napper 115 posts 349 karma points
    Jul 18, 2023 @ 14:22
    Simon Napper
    0

    I'm sure you have, but do you have the IP address of the machine that's trying to connect to the database whiltelisted?

  • Kade 4 posts 24 karma points
    Jul 18, 2023 @ 16:45
    Kade
    0

    Thats the umbraco site, and yes. Its strange because the same pipeline is used to deploy to others envs and those envs are working fine with no issue.

Please Sign in or register to post replies

Write your reply to:

Draft