Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do connect to the db, where active objects entities are being saved?

vdidk March 6, 2019

Hi, 
I'm trying to look through data, that is saved in my plugin with the help of active objects. I'm sure it exists as i can see it during debugging. But I can't find the schema with other tools. 
When I follow this instructions https://confluence.atlassian.com/jirakb/accessing-jira-s-h2-embedded-database-776818136.html i'm getting access to INFORMATION_SCHEMA, but not mine.
Please, help.

2 answers

1 accepted

0 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 21, 2019

With the SDK, I think the steps to access that H2 database would be similar, but I wasn't sure of the exact path to try.   So I installed the Atlassian SDK myself and started following the plugin tutorial.  To my surprise, I found that with Jira running, after I logged in with admin/admin credentials, the top navigation bar has a DbConsole link.  

dbconsole.png

This is not something you see in standard Jira, but appears at least to be a nice feature of the SDK itself.

When I click that, I get taken to a URL of http://localhost:2990/jira/plugins/servlet/database-console/login.do

This is a built in view of the Jira database, complete with the AO tables.  Perhaps this would help you access that data without having to follow that first KB, which is geared for different, non-SDK installs of Jira.

I used the 8.0.7 version of the Atlassian SDK.  So perhaps older versions might not have this feature.

Perhaps this would help you access that data.  And if for some reason you still want to try to follow the first KB, you can still find the specific database location for that instance by clicking on that dbconsole link and looking at the top level.  In my instance on a Mac this path this

jdbc:h2:file:/Users/myusername/andytest/myPlugin/target/jira/home/database/h2db

This is the same path you would need to use to access this database via any other database tool.

vdidk March 22, 2019

Thank you so much!!! The answer was totally helpful!

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 8, 2019

I have had this same problem before when trying to follow that KB.  In my case I found that if I did not enter the URL exactly correct in steps 3 and 4, the application would still appear to connect to something, but only show the information schema like you describe.  When that happens you have not actually connected to the Jira database yet.

Which leads me to believe that your Jira is either storing the H2 database in a different location, or actually isn't using an H2 database.

Are you using the Atlassian SDK to help create your plugin?   Or have you deployed a Jira server installation using a supported database like postgresql instead?

Ideally, I'd like to try to recommend just using a postgresql database, and then access that with a utility like pgadmin.  However this might not be feasible in an SDK environment. 

Could you share with us the specific jdbc URL you are using here and the contents of the $JIRAHOME/dbconfig.xml for this environment?  It would help us to better understand exactly what settings/parameters you need to be able to connect to this.

vdidk March 21, 2019

I'm using Atlassian SDK to create my plugin.
the content of dbconfig.xml is following

<jira-database-config>
<name>defaultDS</name>
<delegator-name>default</delegator-name>
<database-type>h2</database-type>
<schema-name>PUBLIC</schema-name>
<jndi-datasource>
<jndi-name>java:comp/env/jdbc/JiraDS</jndi-name>
</jndi-datasource>
</jira-database-config>

 

Suggest an answer

Log in or Sign up to answer