Bitbucket Server fails to connect to SQL Server: The database name component of the object qualifier must be the name of the current database.
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
Get the name of the database by running this SQL query:
SELECT name, database_id, create_date FROM sys.databases;
Compare it with the database name you are currently using, depending on weather you are:
Running the migration or setup wizard: Compare with the "Database name" field.
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>
- Update the database name so that it matches the name of the database from the SQL query (case sensitive)