title: DATABASECHANGELOGLOCK and DATABASECHANGELOG tables
body: <p>In our application there are four SQL Server databases:</p>
  <pre><code>db1
  db2
  db3
  db4
  </code></pre>
  <p>While connecting to SQL Server using liquibase we use db2 in connection string and then perform deployment.</p>
  <p>As db2 is used in connection string DATABASECHANGELOGLOCK and DATABASECHANGELOG are created in db2 database.</p>
  <p>As a part of deployment, every SQL script has database name at the start like</p>
  <p>Script1.sql</p>
  <pre><code>USE db1
  GO
  
  —update/delete statements
  
  GO
  </code></pre>
  <p>Script2.sql</p>
  <pre><code>USE db2
  GO
  
  —update/delete statements
  
  GO
  </code></pre>
  <p>Script3.sql</p>
  <pre><code>USE db3
  GO
  
  —update/delete statements
  
  GO
  </code></pre>
  <p>Script4.sql</p>
  <pre><code>USE db4
  GO
  
  —update/delete statements
  
  GO
  </code></pre>
  <p>If the last script in the deployment is db2 (as it is specified in the connection string and the DATABASECHANGELOGLOCK and DATABASECHANGELOG) are created in db2 database. Then the deployment succeeds</p>
  <p>But if the last script is of some other database (other than db2) I get an error:</p>
  <blockquote>
  <p>liquibase.exception.LockException: liquibase.exception.LockException: Did not update change log lock correctly.</p>
  </blockquote>
  <p>Seems it goes to search the DATABASECHANGELOGLOCK and DATABASECHANGELOG in the database in which last script is deployed.</p>
  <p>How I can handle this?</p>