This is my goal i need to update the external database whenever a ticket is raise in jira.Event has been triggered then script will run to update a table in MS SQL server . Anyone know how to do it or to put the jdbc for sql server in JIRA files?note: Our Jira is in Mysql.
What plugin do you use from quering your database? Usually you put additional libraries to the lib folder of you Jira.
Hi alex,I will use a groovy script runner.import groovy.sql.*;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.Statement;def sql = Sql.newInstance('jdbc:sqlserver://localhost:port;databaseName=dbName', 'username', 'password', 'com.microsoft.jdbc.sqlserver.SQLServerDriver') sql.execute("INSERT INTO table(testcolumn) VALUES ('test value')"); sql.close()and here is the error:2018-03-09 14:37:48,323 WARN [common.UserScriptEndpoint]: Script console script failed: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver not found by com.onresolve.jira.groovy.groovyrunner [198] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955) at Script21.run(Script21.groovy:7)My external db is MS SQL SERVER 2008 R2and i use sqljdbc64.jar i place it under JIRA_HOME/lib directorywhat was wrong with this?Thank you,Randy
You need to put your driver into the lib folder of you Jira and restart your Jira.
Kindly have a look at the page on how to query databases from ScriptRunner:
https://scriptrunner.adaptavist.com/5.3.7/jira/recipes/misc/connecting-to-databases.html
i also tried that sample and it is still got the same error.Im just curious where to put the driver is it in JIRA_HOME/lib? or maybe in different lib?
As far as I understand you created the lib directory? I do not have access right now to Jira. But I think the lib folder is situated in the Jira_installation folder. It must be already available in your Jira instances. And there must be already drivers for some databases.
It looks like you're new here. Sign in or register to get started.