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
}