about use mysql lib

Jianming_ZHU April 11, 2018

hi dear vendor, I’m using confluence scriptrunner now. in my script , I want to do some interaction with my mysql DB. I use follow code: import groovy.sql.Sql def connect = Sql.newInstance("jdbc:mysql://myhost", "username", "password", "org.gjt.mm.mysql.Driver") def sql_insert = "INSERT INTO pageinfo VALUES('1','testname1')" connect.execute(sql_insert) but I meet the ERROR " org.gjt.mm.mysql.Driver could be found. I think it is due to I lack the MySQL-connecction-java.jar could you tell me how could I import a third-party lib in confluence? thanks for help.

1 answer

1 accepted

1 vote
Answer accepted
Adrián Plaza [DEISER]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2018

Hi @Jianming_ZHU,

 

You need to add the "MySQL-connection-java.jar" in the folder "{confluence-install}/lib", restart Confluence, and try to execute the script.

 

Cheers,
Adrián.

Jianming_ZHU April 12, 2018

Hi Adrian,

thanks the support very much.

Now I have resolved this issue.

 

by the way, I have another question about scriptrunner. I could trigger some post-action via EventHandler, is there anyway to do some pre-action?

for example, if I delete a page, before confluence execute the delete action, could I trigger sth via script?

 

thanks very much.

Adrián Plaza [DEISER]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 12, 2018

Hi @Jianming_ZHU,

 

If my comment helps you to solve your problem can you please mark as accepted answer? please, this can help other people to find a solved question.

 

About your new question, you need to look at the Script Runner documentation about event Handlers: https://scriptrunner.adaptavist.com/latest/confluence/ConfluenceEventHandlers.html

 

Cheers,

Adrián.

Jianming_ZHU April 12, 2018

OK, I have marked it as accepted,thanks for the support again.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events