Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to import mysql-connector-java to groovy script(Assets automation)

Aleksandr Derugo
Contributor
September 16, 2024 edited

Hi!

I tried to connect to MySQL DB from groovy script in Assets Automation and I always get the error

GroovyInsightException: com.mysql.cj.jdbc.Driver not found by com.riadalabs.jira.plugins.insight [221]'

I tried to add @grab

@grab(group='mysql', module='mysql-connector-java', version='8.0.33'), but it didn`t help.

 

@grab(group='mysql', module='mysql-connector-java', version='8.0.33')

import groovy.sql.Sql

final def sql = Sql.newInstance("jdbc:mysql://host:port/dbName", "dbUser", dbPassword, 'com.mysql.cj.jdbc.Driver')

Any ideas?

Thanks

1 answer

1 accepted

0 votes
Answer accepted
Aleksandr Derugo
Contributor
September 24, 2024

I couldn't import the driver, but I found a workaround. I created a database connection in SciptRunner - Resources and used it in the groovy script.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events