Bitbucket Server fails to connect to SQL Server: The database name component of the object qualifier must be the name of the current database.

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

The following error occurs when attempting to connect to a Microsoft SQL Server database:

com.microsoft.sqlserver.jdbc.SQLServerException: The database name component of the object qualifier must be the name of the current database.

Diagnosis

Environment

  • Microsoft SQL Server

Cause

The database name does not match the name of the Microsoft SQL database. This can occur when an invalid database name is in either the "Database name" field during the migration or setup wizard, or specified in <home-directory>/shared/bitbucket.properties. The database name is case-sensitive.

Resolution

  1. Get the name of the database by running this SQL query:

    SELECT name, database_id, create_date  
    FROM sys.databases;  
  2. Compare it with the database name you are currently using, depending on weather you are:

    1. Running the migration or setup wizard: Compare with the "Database name" field.

    2. Starting Bitbucket Server normally: Compare with the <database name> configured in <home-directory>/shared/bitbucket.properties: (A restart of Bitbucket Server is required)

      jdbc.url=jdbc:jtds:sqlserver://<host>:<port>/<database name>
  3. Update the database name so that it matches the name of the database from the SQL query (case sensitive)


Last modified on Jun 26, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.