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
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.