The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

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

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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.

TAGS
AUG Leaders

Atlassian Community Events