Post-function to run an SQL query (on the Linux server)

Hi Colleagues,
Is there a way to start Linux script or etc. to run SQL query while transition?

Thank you in advance

With kind regards
Vyacheslav Starovoytov
TSD Group

1 answer

0 vote

Yes, there's an "excute" method you can use on strings, which is a bit inelegant, but a starting point.  For example "ls -l".execute()

But, you'll almost certainly be wanting to trap any output and probably store it if you're doing that, and that gets more complex.

You mention SQL as well - that's also possible, although I'd let the system do the work - if you have the right driver installed, groovy supports execution of SQL via that.

However, I'd want to ask "why"?  If your SQL is to be run on JIRA data, then there's actually a good chance that you should not be doing it at all.

Hi, Nic,

Thanks for the support!

My case is:

On the SQL-server we have two DB: one is JIRA and other it is our own. My need is to insert/update data in our own database when issue is being moved or when there is a custom event.

Is there a way to not do it (e.g. with Groovy or etc.)?

Hey Vyacheslav

There is a similar example in the documentation -

Connecting to databases

regards,

Thanos

Yes, I'd use Thanos's example code to create a connection to the other database.

My fear (which happens too much) is that you might be trying to write to the JIRA database - don't ever do that.  Updating your other database from JIRA is fine (assuming it's not sensitive like JIRA rightly is)

Ok, thanks Thanos and Nic!

I will try the link above and come back with reply!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

181 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you