2

I am trying to deploy a dacpac to SQL 2014 by code. It works perfectly with Windows Authentication, but when I use SQL server authentication I get the following error:

Could not deploy package. Inner Exception: Unable to connect to target server.

I can log in to SQL Management Studio with the user and deploy the dacpac, with no issues.

Works:

Data Source=JJ_LAPTOP\SQLEXPRESS;Initial Catalog=BioMasterMain;Integrated Security=True;

Doesn't work:

Data Source=JJ_LAPTOP\SQLEXPRESS;Initial Catalog=BioMasterMain;User ID=sample;Password=sample;

Code:

var databaseVersion = GetCurrentDacVersionFromDatabase(dbConnString);
            var dacPackage = DacPackage.Load(dacPacPath);
            if (dacPackage.Version > databaseVersion)
            {
                var dacServices = new DacServices(dbConnString);

                // Change any dacDeployOptions here. 
                var dacDeployOptions = new DacDeployOptions {RegisterDataTierApplication = true};

                dacServices.Deploy(dacPackage, "BioMasterMain", true, dacDeployOptions); <-- Fails here
            }
Dhanuka
  • 2,826
  • 5
  • 27
  • 38
jjbaird
  • 31
  • 5
  • Do other actions using SQL server authentication work against the database? Does the user you are connecting with have permissions to access the server? I would suggest checking out the permissions and ensure your SQL user has the same as the Windows user you were able to use successfully. – Kevin Cunnane May 26 '15 at 05:28

0 Answers0