Troubleshooting SQL Server Connection Issues Print

  • 0

SQL Server Connection Troubleshooting

This guide helps resolve common SQL Server connection problems on Windows hosting.

Issue 1: Cannot Connect from Application

Verify Connection String:

// Correct format for shared hosting:
Server=YOURSERVER\YOURINSTANCE;Database=YOURDBNAME;User Id=YOURUSER;Password=YOURPASSWORD;

// Or using integrated port:
Server=sql.yourhost.com,1433;Database=YOURDBNAME;User Id=YOURUSER;Password=YOURPASSWORD;

Common Connection String Mistakes:

  • Using localhost instead of actual server name
  • Missing instance name after backslash
  • Wrong database name (case-sensitive)
  • Incorrect username or password

Find Your Connection Details:

  1. In Plesk, go to Websites & Domains
  2. Click Databases
  3. Click on your database name
  4. Connection info is displayed under "Connection Information"

Issue 2: Cannot Connect from SSMS (SQL Server Management Studio)

Remote Connections:

Important: Remote SQL connections may require:

  • IP address whitelisting by support
  • Correct external connection details
  • TCP/IP protocol enabled

SSMS Connection Settings:

  • Server type: Database Engine
  • Server name: Use hostname provided by your host
  • Authentication: SQL Server Authentication
  • Login: Your database username
  • Password: Your database password

Issue 3: Login Failed Errors

"Login failed for user" Messages:

Error Cause Solution
Login failed for user 'X' Wrong credentials Reset password in Plesk Databases
User does not have access to database Permission issue Verify user is assigned to database
Cannot open database Database doesn't exist or offline Check database exists in Plesk

Reset Database User Password:

  1. In Plesk, go to Databases
  2. Click User Management
  3. Select the user and change password

Issue 4: Timeout Errors

Connection Timeout:

// Increase timeout in connection string:
Server=YOURSERVER;Database=YOURDB;User Id=USER;Password=PASS;Connection Timeout=30;

Command Timeout (for long queries):

// In C#:
command.CommandTimeout = 120; // 120 seconds

// In connection string:
Command Timeout=120;

Issue 5: Database Size/Space Issues

Check Database Size in Plesk:

  1. Go to Databases
  2. Size is shown next to each database
  3. Check against your plan's database size limit

Shrink Database (contact support):

If your database log file is large, contact support to:

  • Shrink the log file (.ldf)
  • Change recovery model if appropriate
  • Set up log file size limits

Issue 6: Entity Framework Connection Issues

appsettings.json Configuration:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=YOURSERVER;Database=YOURDB;User Id=USER;Password=PASS;TrustServerCertificate=True;"
  }
}

Common EF Core Issues:

  • Add TrustServerCertificate=True for self-signed certs
  • Add Encrypt=False if encryption not configured
  • Verify migrations have been applied

Quick Troubleshooting Checklist

  1. ☐ Connection string format is correct
  2. ☐ Server/instance name is accurate
  3. ☐ Database name exists and is spelled correctly
  4. ☐ Username and password are correct
  5. ☐ User has access to the specific database
  6. ☐ Firewall allows connection (for remote access)
  7. ☐ Database is online and not over quota

Was this answer helpful?

« Back