Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Schema Comparison Error "Target is unavailable"

When comparing an SQLServer project in Visual Studio 2015 Update 2 against a database SQL Server 2012, it shows the error "Target is unavailable" or "Source is unavailable" when change the direction.

It used to work properly a couple of months ago. Is there any workaround? I couldn't find any.

like image 890
dave Avatar asked May 26 '16 14:05

dave


3 Answers

I have found that using username@servername as the username for connecting will fix the issue when it happens against Azure databases. I've had connections that have historically worked without doing this suddenly stop and then this has fixed it for me.

For instance, when using a login of mylogin and connecting to myserver.database.windows.net, if I instead use [email protected] as the username I won't get the "Source is unavailable" issue.

like image 125
Stacy Vicknair Avatar answered Nov 14 '22 11:11

Stacy Vicknair


I get this error in Visual Studio 2017 when I use SQL Server Authentication but don't save the password. I've tested these steps with Visual Studio 15.6.3 and SQL Server 12.0.5000.0

Fixing the error

This fixes the problem, but the problem comes back the next time I restart Visual Studio.

  1. Go to Tools -> SQL Server -> New Schema Comparison...
  2. Select either Select Source or Select Target
  3. Select Select Connection
  4. Under Recent Connections, find all connections that gave you this error
  5. For each of these, right-click the connection and select Remove from History
  6. Restart Visual Studio

Preventing the error from coming back

  1. Complete Fixing the error above
  2. When you are setting the connection details, check the Remember Password checkbox.

Reproducing the error

If you want to troubleshoot this error, here is how I managed to reproduce it.

  1. Go to Tools -> SQL Server -> New Schema Comparison...
  2. Select a source and target connection
  3. For at least one connection, use SQL Server Authentication but don't select Remember Password
  4. Press Compare
  5. Ensure it works without errors
  6. Restart Visual Studio
  7. Repeat steps 1-4, using the exact same connection details
like image 89
Sam Avatar answered Nov 14 '22 09:11

Sam


After trying everything here, this is what worked for me:

  1. Close VS instance.

  2. Delete the saved connection keys in

HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\ConnectionMruList

  1. Reopen VS and try again.
like image 27
sotn Avatar answered Nov 14 '22 11:11

sotn