When connecting to a named instance JIRA throws Connection refused
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
When attempting to connect to a database during a JIRA installation you get the following error:
Error connecting to database
Network error IOException: Connection refused: connect
Connection refused: connect
Cause
Connecting to a named SQL database instance (popular with Clustering implementations of SQL Server) requires a special syntax.
Resolutions
Confirm that there is no firewall blocking the connection and the SQL server is running and accepting connections from JDBC-based utilities.
Manual Database configuration
- Stop JIRA.
Use the following $JIRA_HOME/
dbconfig.xml
, replacing the username, password, and URL information as appropriate.
JIRA 7.4.x versions and before using the jtds database driver:<jira-database-config> <name>defaultDS</name> <delegator-name>default</delegator-name> <database-type>mssql</database-type> <schema-name>jiraschema</schema-name> <jdbc-datasource> <url>jdbc:jtds:sqlserver://<YOUR_SERVER_FQDN>/<YOUR_DB_NAME>;instance=<YOUR_INSTANCE_NAME></url> <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class> <username>jiradbuser</username> <password>password</password> <pool-min-size>20</pool-min-size> <pool-max-size>20</pool-max-size> <pool-max-wait>30000</pool-max-wait> <pool-max-idle>20</pool-max-idle> <pool-remove-abandoned>true</pool-remove-abandoned> <pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout> <validation-query>select 1</validation-query> <min-evictable-idle-time-millis>60000</min-evictable-idle-time-millis> <time-between-eviction-runs-millis>300000</time-between-eviction-runs-millis> <pool-test-while-idle>true</pool-test-while-idle> </jdbc-datasource> </jira-database-config>
JIRA 7.5.x versions and above using the Microsoft SQL database driver:
<jira-database-config> <name>defaultDS</name> <delegator-name>default</delegator-name> <database-type>mssql</database-type> <schema-name>jiraschema</schema-name> <jdbc-datasource> <url>jdbc:sqlserver://<YOUR_SERVER_FQDN>\<YOUR_INSTANCE_NAME>:1433;databaseName=jiradb</url> <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class> <username>jiradbuser</username> <password>password</password> <pool-min-size>20</pool-min-size> <pool-max-size>20</pool-max-size> <pool-max-wait>30000</pool-max-wait> <pool-max-idle>20</pool-max-idle> <pool-remove-abandoned>true</pool-remove-abandoned> <pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout> <validation-query>select 1</validation-query> <min-evictable-idle-time-millis>60000</min-evictable-idle-time-millis> <time-between-eviction-runs-millis>300000</time-between-eviction-runs-millis> <pool-test-while-idle>true</pool-test-while-idle> </jdbc-datasource> </jira-database-config>
This difference in the jdbc database drivers was noted int he JIRA 7.5 release notes as well, and in the KB Updating JDBC URL for Microsoft SQL Server.
- Start JIRA and verify it starts up.
Setup Wizard Method
Step 2 of 4 in the setup wizard will prompt you for the database name. Use the following syntax for the database name.
JIRA 7.4.x and before versions:
<DB_Name>;instance=<Instance_Name>
JIRA 7.5.x and higher versions:
<Instance_Name>;databaseName=jiradb