Connecting to named instances in SQL Server from Stash

'How Do I...' and 'How to...' Guide to Stash

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

When using named instances you will need to specify the URL slightly differently in the connection properties. This issue will be addressed through  STASH-3759 - Getting issue details... STATUS

Basically you could be trying one of the 2 options below:

  • Linking an empty instance to a SQL Server Named Instance
  • Migrating from HSQLDB to SQL Server

Linking an empty instance to a SQL Server Named Instance

In this scenario, after executing the procedure below, you will have your Stash instance linked to a new and empty Named Instance database.

To perform this, either you currently have no data at all stored in your Stash instance (or they are not relevant) and the repositories could be either discarded or they could be manually imported into the new instance linked to your SQL Server later on.

Before performing the procedure below, please make sure you have an empty database that is configured according to the documentation: Connecting Stash to SQL Server. Make sure you can connect to it with a third-party tool before proceeding.

Procedure:

  • Create/edit the stash-config.properties within your $STASH_HOME/shared with the following content:

    jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
    jdbc.url=jdbc:sqlserver://<hostname>\\<instance_name>;databaseName=<database_name>
    jdbc.user=stash
    jdbc.password=stash

Alternatively use the URL below in case the one above does not work:

jdbc.url=jdbc:sqlserver://<hostname>;instanceName=<instance_name>;databaseName=<database_name>;
  • Tweak the parameters jdbc.url, jdbc.user and jdbc.password accordingly.
  • As soon as you restart Stash, it will try to connect to the database using the parameters above. If this step is successful, it won't detect anything in there as the database is empty. Stash will "think", then, that this is a new installation and you will have to go through the process again.
  • In case of failure, you can always remove stash-config.properties and it will use the HSQLDB.
  • In major failures, use the backup client to restore your instance.

A migration from HSQLDB to SQL Server

Due to STASH-3759, it is not possible to migrate a SQL Server Named instance Using the Database Migration Wizard.

An alternative is to use our backup client and perform a current backup of your instance.

You can later on Restore Stash into a newly created DB instance pointing now to your newly created SQL Server empty database passing the parameters below during the restore (configuration below is related to the backup/restore client):

jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://<hostname>\\<instance_name>;databaseName=<database_name>
jdbc.user=stash
jdbc.password=stash

Alternatively use the URL below in case the one above does not work:

jdbc.url=jdbc:sqlserver://<hostname>;instanceName=<instance_name>;databaseName=<database_name>;

In $STASH_HOME/shared/stash-config.properties, please add the following for the jdbc.url:

jdbc.url=jdbc:sqlserver://<hostname>\\<instance_name>;databaseName=<database_name>

i.e.

jdbc.url=jdbc:sqlserver://localhost\\MSSQL13;databaseName=stash

Alternatively:

jdbc.url=jdbc:sqlserver://<hostname>;instanceName=<instance_name>;databaseName=<database_name>;

i.e.

jdbc.url=jdbc:sqlserver://localhost;instanceName=MSSQL13;databaseName=stash;

Last modified on Nov 2, 2018

Was this helpful?

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