Skip to main content
Skip table of contents

Example of a CSV file used as a JNDI

Install the CSV JDBC driver

Access the following link: https://sourceforge.net/projects/csvjdbc/files/CsvJdbc/

  • Download the jar file:

    8ab36f6e-a7e4-49b8-aaa5-b465e0475724.png
  • Copy this file into the lib  folder of your Jira server.

Copy the CSV file to Jira

Copy the CSV file to your Jira installation directory.

You can create a specific folder where all your CSV files will be grouped together:

1592b899-09ca-4f29-80d8-71583af16bc2.png

In this example, the Jira instance is a standalone installation on a Windows system, so the path is:

CODE
C:\Users\Simon Laffont\Atlassian\Jira-9.0.0\csv-files

Edit the “server.xml” file

  • Edit the server.xml file, located in the conf directory of your Jira installation. The exact path to this file depends on where you installed Jira, but it generally follows this pattern:

    • Linux/Unix/MacOS: /path/to/jira-install-directory/conf/server.xml

    • Windows: C:\path\to\jira-install-directory\conf\server.xml

  • Locate the Context section (under Engine > Host), and add the following resource to it:

    CODE
    <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">
      <Resource name="jdbc/{ressource_name}"
    		auth="Container"
    		type="javax.sql.DataSource"
    		driverClassName="org.relique.jdbc.csv.CsvDriver"
    		url="jdbc:relique:csv:{/Path/to/csv/files/folder}?separator=,"
      />
    </Context>

    (info) Replace {ressource_name} with the name of your choice, and {/Path/to/csv/files/folder} with the path to the CSV file.

  • In this example:

    • The resource has been named "csv-datasource"

    • The CSV file path mentioned above is “C:/Users/Simon Laffont/Atlassian/Jira-9.0.0/csv-files“:

      CODE
      <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">
        <Resource name="jdbc/csv-datasource"
      	auth="Container"
      	type="javax.sql.DataSource"
      	driverClassName="org.relique.jdbc.csv.CsvDriver"
      	url="jdbc:relique:csv:C:/Users/Simon Laffont/Atlassian/Jira-9.0.0/csv-files?separator=,"
        />
      </Context>
  • Then, restart the Jira instance.

Create the JNDI datasource in Elements Connect

  • Access the Elements Connect administration

  • Go to the Datasources tab

  • Create a “JNDI reference” datasource:

    6f32938c-c09a-4b0f-9bc9-8fdeca7926b2.png
  • Complete the "JNDI name" with:

    CODE
    java:comp/env/jdbc/{resource_name}
  • In our example, we need to replace {ressource_name} with “csv-datasource” (cf. the resource name specified in the server.xml file above):

    23266044-1bef-408e-b6c4-ce69b3500ad8.png

By entering the resource name, the corresponding path mentioned in the “server.xml” is retrieved.
This way, the JNDI datasource can access all CSV files that have been copied to this location.

Once the JNDI datasource is configured, any new CSV files you add to the specified path, or any updates to existing CSV files, are immediately reflected in Elements Connect, and there's no need to restart Jira.

Configure a Connect field

  • Create a Connect field using the previously created JNDI datasource.

  • To retrieve data from a specific CSV file, you must specify the filename in the query, just as you would for an SQL table:

    • Here is the CSV file concerned:

      1592b899-09ca-4f29-80d8-71583af16bc2 (1).png
    • And here is what the query should be:

      9c9df9a7-a8d5-4f21-8539-80643cb504c7.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.