What plug-ins does jira software typically use to link to external databases?And the implementation of data insertion, extraction
There 2-3 parts to your question,
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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()
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you restarted Jira after this? And also
Have you checked this - https://scriptrunner.adaptavist.com/latest/jira/resources.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.