You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I am using the following code to query my database in scriptrunner for Jira. I am receiving the following error
How can I print which object names are available? That way, I know what query to use. package SuperFeature
import com.atlassian.jira.issue.Issue
import org.apache.log4j.Logger
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.atlassian.jira.bc.project.component.ProjectComponentManager
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.label.LabelManager
import SuperFeature.Configuration_SuperFeature
import groovy.sql.Sql
import java.sql.Driver
import java.sql.*
def log = Logger.getLogger('atlassian-jira.log')
def driver = Class.forName('com.microsoft.sqlserver.jdbc.SQLServerDriver').newInstance() as Driver // <1>
def props = new Properties()
props.setProperty("user", "webM_Feature") // <2>
props.setProperty("password", "webM_Feature")
String connectstmt= "jdbc:sqlserver://ireport:1433;RND_webM_Feature="
log.warn("MOUNA CAMELIA "+connectstmt)
def conn = driver.connect(connectstmt, props) // <3>
def sql = new Sql(conn)
try {
String query = "SELECT cycle, line, prod, fcomp, sfcomp, pm, rnd FROM dbo.itrac_rnd"
ResultSet rs = sql.executeQuery(query);
while (rs.next()) {
log.warn("MOUNA CAMELIA "+rs.getString("cycle"))
}
} finally {
sql.close()
conn.close()
}
You are getting the error message because there is an error in the Database schema you are currently using.
Please read this Jira KB Document for steps to overcome this issue.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.