Jump to content
We've recently updated our Privacy Statement, available here ×
  • How-to find all scheduled reports in jasperserver repository with the sql query


    akonkin
    • Features: JasperReports Server, Reports, Repository, Scheduler Product: JasperReports® Server

    Sometimes due to different reasons we need to find all scheduled jobs in jasperserver Repository database. This can be easily done in the modern versions of the software (since 5.2 version ) - a "Scheduled" filter was added to the Search panel:

    Scheduled_filter.png.15e430291651b93da07633fd46b87837.png

    To find all scheduled reports in the versions of the software in which this feature is not available you can connect to jasperserver Repository database and execute the query that I quote below (this query has been tested with PostgreSQL, please adopt it to the database of your choise):

    select * from jireportjob j
    left outer join jireportjobcalendartrigger j1 on j.id = j1.id
    left outer join jireportjobmail j2 on j.id = j2.id
    left outer join jireportjobmailrecipient j3 on j.id = j3.destination_id
    left outer join jireportjoboutputformat j4 on j.id = j4.report_job_id
    left outer join jireportjobparameter j5 on j.id = j5.job_id
    left outer join jireportjobrepodest j6 on j.id = j6.id
    left outer join jireportjobsimpletrigger j7 on j.id = j7.id
    left outer join jireportjobtrigger j8 on j.id = j8.id;
    

    In my repository I have only one report that was scheduled when I executed this query. You can see the results of execution of this sql query in the screenshot below:

    sql_query.png.dd971388983263949de2afe054546a2b.png

    Thank you for your attention to this article.

    Best regards,

    Alex

     

    For Version 3.0.0.0
     
    I think will be useful this query for the very old Jasperserver version 3.0
     
    SELECT * FROM JIReportJob j LEFT OUTER JOIN JIReportJobTrigger jrt ON j.job_trigger = jrt.idLEFT OUTER JOIN JIReportJobCalendarTrigger jct ON jrt.id = jct.idLEFT OUTER JOIN JIReportJobSimpleTrigger jst ON jrt.id = jst.idLEFT OUTER JOIN JIReportJobMail jrm ON j.mail_notification = jrm.idLEFT OUTER JOIN JIReportJobMailRecipient jmr ON jrm.id = jmr.destination_id 
     

    For JS 6.3 Database running with mariaDB:

    SELECT * FROM jireportjob jLEFT OUTER JOIN jireportjobcalendartrigger j1 ON j.job_trigger = j1.idLEFT OUTER JOIN jireportjobmail j2            ON j.mail_notification = j2.idLEFT OUTER JOIN jireportjobmailrecipient j3   ON j.mail_notification = j3.destination_idLEFT OUTER JOIN jireportjoboutputformat j4    ON j.id = j4.report_job_id-- LEFT OUTER JOIN jireportjobparameter j5      ON j.id = j5.job_idLEFT OUTER JOIN jireportjobrepodest j6        ON j.id = j6.idLEFT OUTER JOIN jireportjobsimpletrigger j7   ON j.id = j7.idLEFT OUTER JOIN jireportjobtrigger j8         ON j.job_trigger = j8.idLEFT OUTER JOIN jireportjobalert j9           ON j.alert = j9.id

     

     

    sql_query.png.e8d76282f31f9689d565aa5c9f3bff61.png


    User Feedback

    Recommended Comments

    I needed a report export that had schedule's emails in it, so I took this and changed it for my own needs. I didn't do the best job in matching up all the new IDs but did it quickly. Posting it in case anyone else might need it for this.

     

    SELECT * FROM jireportjob j
    LEFT OUTER JOIN jireportjobcalendartrigger j1 ON j.job_trigger = j1.id
    LEFT OUTER JOIN jireportjobmail j2 ON j.mail_notification = j2.id
    LEFT OUTER JOIN jireportjobmailrecipient j3 ON j.mail_notification = j3.destination_id
    LEFT OUTER JOIN jireportjoboutputformat j4 ON j.content_destination = j4.report_job_id
    LEFT OUTER JOIN jireportjobparameter j5 ON j.content_destination = j5.job_id
    LEFT OUTER JOIN jireportjobrepodest j6 ON j.content_destination = j6.id
    LEFT OUTER JOIN jireportjobsimpletrigger j7 ON j.job_trigger = j7.id
    LEFT OUTER JOIN jireportjobtrigger j8 ON j.job_trigger = j8.id;
    LEFT OUTER JOIN jiuser j9 ON j.owner = j9.id;

    Link to comment
    Share on other sites



    Guest
    This is now closed for further comments

×
×
  • Create New...