Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

What plug-ins does jira software typically use to link to external databases

haiyaner August 26, 2019

What plug-ins does jira software typically use to link to external databases?And the implementation of data insertion, extraction

2 answers

1 accepted

0 votes
Answer accepted
DPKJ
Community Champion
August 27, 2019

There 2-3 parts to your question,

  1. What connection type Jira uses?
    • Jira being a Java application uses JDBC database connections
    • It doesn't require any plugin, it is integrated in Jira itself.
    • For MySQL and Oracle, you need to prove JDBC connection library during installation (because of license restrictions by Oracle)
  2. What options plugin-ins have to connect to Jira database?
  3. What does Jira internally uses (like hibernate etc)
    • I have seen traces of hibernate in Jira, but it is not exposed to plugin developers.
haiyaner August 27, 2019

Hi, now that I have jira installed, how do I configure it if I want to use groovy script to read and write to an external database

DPKJ
Community Champion
August 27, 2019

@haiyanerTo use Groovy Scripts in Jira you will need plugin called`ScriptRunner` - https://marketplace.atlassian.com/apps/6820/scriptrunner-for-jira?hosting=cloud&tab=overview

ScriptRunner provide you with recipes to connect with external database and use its data in Jira - https://scriptrunner.adaptavist.com/latest/jira/recipes/misc/connecting-to-databases.html

You can also watch this video - https://youtu.be/qNEdQeY-fMA

Like haiyaner likes this
haiyaner August 27, 2019

thanks ,i'll try it

haiyaner August 27, 2019

@DPKJ Hello, according to you to address, when I link to the mysql database,

" Java. Lang. ClassNotFoundException: com. Mysql. JDBC. The Driver ", 

how to solve this problem?

haiyaner August 27, 2019

jietu.png

DPKJ
Community Champion
August 27, 2019

@haiyanerJira doesn't ship with MySQL Driver by default. You will need to add it manually to <installation>/lib directory and restart Jira server, before you can create connection using ScriptRunner.

In case you are using MySQL for your Jira itself, try to import everything explicitly. Like in this example,

import groovy.sql.Sql
import java.sql.Driver

def driver = Class.forName('org.postgresql.Driver').newInstance() as Driver

def props = new Properties()
props.setProperty("user", "devtools")
props.setProperty("password", "devtools")

def conn = driver.connect("jdbc:postgresql://localhost:5432/jira_6.4.6", props)
def sql = new Sql(conn)

try {
sql.eachRow("select count(*) from jiraissue") {
log.debug(it)
}
} finally {
sql.close()
conn.close()
}
haiyaner August 27, 2019

yup, I added "mysql-driver.jar" under the installation path lib, but not yet

DPKJ
Community Champion
August 27, 2019

Have you restarted Jira after this? And also

Have you checked this - https://scriptrunner.adaptavist.com/latest/jira/resources.html

haiyaner August 27, 2019

hi,I tried it, and it worked, but I wanted to apply it to my workflow. How?For example, I create an issue, and then on the next flow, I need to save the Description field to the database

DPKJ
Community Champion
August 27, 2019

There are various guides provided for this.

You bind scripts to workflow stages also, for example see this question - https://community.atlassian.com/t5/Jira-questions/Groovy-to-create-issues/qaq-p/818025

haiyaner August 28, 2019

jira2.pngThank you. I got the data the way you gave me, but from “IssueByCurrentKey”,Is there a general way to get data?

haiyaner August 28, 2019

@DPKJ  Because I'm not going to look for this key every time

DPKJ
Community Champion
August 28, 2019

In workflow and post functions in ScriptRunner you already have access to 'issue' object. You don't need to get it this way.

Just try, to get value from this object without fetching it.

def currentIssue = issue; //use currentIssue or issue hereafter
def key = issue.getKey(); // or currentIssue.getKey();
haiyaner August 28, 2019

Thank you very much, It is my first time to contact jira. I am so lucky to meet you

DPKJ
Community Champion
August 28, 2019

I am a just a member of community, and using and developing on Atlassian tool for 10+ years.

If it really help you can up-vote and accept answer to help others.

Like haiyaner likes this
haiyaner August 28, 2019

ok,thanks

0 votes
Julie d_Antin _Elements_
Atlassian Partner
August 27, 2019

@haiyaner, do you need to populate custom fields in Jira with data from external sources, like SQL databases, LDAPs, or REST APIs?

 

I work for Elements, and our app Elements Connect might be what you are looking for. You can see examples of how Connect links Jira to external databases on the demo portal.

 

Let me know if you have any questions.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events