How Can I access Jira Database?


I am new to Jira development and I want to ask how can I access the database on Jira for a specific plugin? so I can get the user tasks, bugs, and so on in order to write my code for a specific case.

Thanks in advance.

Don’t directly access the Jira database unless you have no other way.

For things like getting the user tasks, bugs, you can you the Services and Managers from Jira to get them done.

Please give more details on the requirements, so I can give you better support.

1 Like

Thanks for your reply.

Actually, my requirement is simple, once the user has 5 tasks or less, the plugin creates a new task for him directly. In this case how I can get the number of tasks per user? how I can create a new task by default from the plugin itself? is related to APIs?

Do you mean the current user has less than 5 Tasks assign to him (the user is the Assignee)? If yes, here is a simple code snippet:

    // Define a JQL to get tasks
    String jql = "type = Task AND assignee = exampleUser";

    // Import the JiraAuthenticationContext, JqlQueryParser and SearchService
    // below to use in your plugin.
    ApplicationUser user = jiraAuthenticationContext.getLoggedInUser();
    Query jqlQuery = jqlQueryParser.parseQuery(jql);

    SearchResults<Issue> searchResults =, jqlQuery, 
    // This list of issues is the tasks of the "exampleUser"
    List<Issue> issues = searchResults.getResults();

It will be the same for creating new tasks, you can import services like IssueService, IssueManager.

This knowledge is quite basic in Jira plugin development, I encourage you to go through the Getting Started document from Atlassian first: