• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Connecting to External MS SQL Database from JIRA using Groovy SQL

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to "connect to an external Microsoft SQL server using groovy sql from within JIRA using script runner console". For the security purpose, I have not mentioned the real values.
Set-up: The SQL JDBC connector has been added as a CLASSPATH in System Variable, location "C:\TEMP\sqljdbc4" downloaded from "sqljdbc_4.0.2206.100_enu". With the actual values, I am able to successfully connect to the SQL Server via SQL Manager Studio.
Problem: The below script is returning "null".
import groovy.sql.Sql
import java.sql.Driver
def driver = Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance() as Driver

def props = new Properties()
props.setProperty("user", "Valid User Name")
props.setProperty("password", "Valid Password")
props.setProperty("database", "Valid DB")
def conn = driver.connect("jdbc:sqlserver://Valid_Server_Name:Valid DB", props)
def sql = new Sql(conn)
log.info "Connected to database successfully"
catch(Exception e){
log.info "some db error"
log.info e.getMessage()
Please help.
Saloon Keeper
Posts: 22483
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It took me several scans of your message to make sense of that.

You're talking like Jira is a build system. Unless it has changed really radically in the last 6 months, it's a ticketing system. I think maybe the Atlassian product you're asking about is Bamboo.

You'd do better if you did a full stack trace print and showed us what that looked like.

One thing, however, Atlassian products are built off standard Java resources, and in the case of online systems that usually includes either an embedded Tomcat server or the option of deploying the app in a Tomcat server you already have. If that's what's running your faiing code then supplying resources from an external CLASSPATH (as a system or environment variable) won't work. Tomcat builds its own classpaths. Usually for JDBC drivers, you drop the driver in the TOMCAT_HOME/lib directory. If this is a build script, however, it may contain a run profile and you might need to add your jar path there.
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic