Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
We've encountered an issue exporting this macro. Please try exporting this page again later.
Excerpt
hiddentrue

Datasources can still be configured directly in Tomcat. Doing this can help ensure the connection does not get accidentally altered through the UI.

Adding a JNDI Datasource

Datasources can still be configured directly in Tomcat. Doing this can help ensure the connection does not get accidentally altered through the UI. The following example apply to Tomcat only. The user should refer to the application server manual on how to define a data source.

  1. Make sure you have the SQL driver in JIRA_HOME/lib directory. The driver should be proper one for the type of the database you want to use.

  2. Open JIRA_HOME/conf/context.xml file with your favorite text editor. Enter your data source, for instance, between the existing <Context> tags copy the following content:

    Example for HSQLDB

    Code Block
    <Resource name="TestDB"
              auth="Container" type="javax.sql.DataSource"
              username="sa"
              password=""
              driverClassName="org.hsqldb.jdbcDriver"
              url="jdbc:hsqldb:/tmp/somedb;create=true;"
     />
    

  3. Restart Jira. 

Check the settings in the Resource tag:

  • name: the name of the data source
    username: The username used for the connection to the database

  • password: The password to connect to the database

  • driverClassName: The name of the class from the driver. The driver should be the proper jar archive for the type of the database used. In this example the type of the database used is hsqldb

  • url: The url used to connect to the database

Note

Note

The Guide on how to configure a datasource is Apache Tomcat: Configuring a Datasource

Settings for Other Databases

PostgreSQL

Code Block
<Resource name="TestDB"
          auth="Container" type="javax.sql.DataSource"
          username="sa"
          password=""
          driverClassName="org.postgresql.Driver"
          url="jdbc:postgresql://127.0.0.1:5432/somedb"
 />

MySQL

Code Block
<Resource name="TestDB"
          auth="Container" type="javax.sql.DataSource"
          username="sa"
          password=""
          driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://127.0.0.1:3306/somedb"
 />

Note

If you want to use a column alias in a select sql and use that alias instead of column name you should add "?useOldAliasMetadataBehavior=true" as a configuration parameter in your JDBC url. This is due to a change in My SQL JDBC driver implementation starting from version 5.1.

More details can be found here: http://bugs.mysql.com/bug.php?id=35150 .

If you use this parameter in combination with other parameters please see also: http://bugs.mysql.com/bug.php?id=35753 .

Oracle

Code Block
<Resource name="TestDB"
          auth="Container" type="javax.sql.DataSource"
          username="sa"
          password=""
          driverClassName="oracle.jdbc.driver.OracleDriver"
          url="jdbc:oracle:thin:@127.0.0.1:1522:somedb" 
	  connectionProperties="SetBigStringTryClob=true"
 />

MS SQL Server

Code Block
<Resource name="TestDB"
 	  auth="Container" type="javax.sql.DataSource"
 	  username="sa"
 	  password=""
 	  driverClassName="net.sourceforge.jtds.jdbc.Driver"
 	  url="jdbc:jtds:sqlserver://localhost:1433/somedb;instance=INSTANCE_NAME" 
 />

Info

For MS Sql Server 2000 the instance name should be omitted from the url, even if connecting to a named instance, so the url attribute should be: url="jdbc:jtds:sqlserver://localhost:1433/somedb".

AS400

Code Block
<Resource name="TestDB"
          auth="Container" type="javax.sql.DataSource"
          username="sa"
          password=""
          driverClassName="com.ibm.as400.access.AS400JDBCDriver"
          url="jdbc:as400://127.0.0.1/somedb;naming=sql;errors=full"
 />

Firebird

Code Block
<Resource name="TestDB" auth="Container" type="javax.sql.DataSource" 
	  username="sysdba" 
	  password="masterkey" 
	  driverClassName="org.firebirdsql.jdbc.FBDriver" 
	  url="jdbc:firebirdsql:127.0.0.1/3050:d:/somedb.fdb" 
/>

Info

To connect to Jira database, see configuration in the dbconfig.xml file from Jira's home directory.

More Configuration Guides

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "configuration" and space = currentSpace ( )

Contents

Table of Contents

SQL Configuration Guides

Child pages (Children Display)
pageSQL Data Source Configuration