connection to external database with groovy script.Getting ecxeption

Meena Sabnivisu April 10, 2018

Hi, I am trying to connect to an external SQL SERVER DB with groovy script console. Here is my code:

import groovy.sql.Sql
import java.sql.Driver
def driver = Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance() as Driver
log.warn"start propeties"
def props = new Properties()
props.setProperty("user", "UserId")
props.setProperty("password", "Password")
props.setProperty("database", "db")
def conn = driver.connect("jdbc:sqlserver://servername", props)
def sql = new Sql(conn)
log.warn "connection created"

 

But I am getting class not found exception for "com.microsoft.sqlserver.jdbc.SQLServerDriver" .

 

I have also placed mssql-6.4jre.jar file in /Jira/lib.

 

Plz answer.Thanks

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events