Jira connects to the bad database

Hello !

We have a production server and a test one.

Recently, to prepare the migration to last version of Jira, we made a copy of the production server to replace the test server. I've changed the jira/dbconfig.xml file to specify the test database but it still tries to connect to the production database. Il the log file of the test server, I have this :

com.atlassian.jira.exception.DataAccessException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'jira'@'a.b.c.d' to database 'jira'

In dbconfig.xml, I have this :

<database-type>mysql</database-type>
<schema-name>jiratest</schema-name>
<jdbc-datasource>
<url>jdbc:mysql://my.dbserver.fr:3306/jiratest?useUnicode=true&amp;characterEncoding=utf8&amp;sessionVariables=storage_engine=InnoDB</url>

Any idea ?

5 answers

1 accepted

I finally found where was the problem !

Production server is configured to access website by a classical URL instead of :8080 port. When copying the production server to replace the test one, production config has been copied too. I access test server by its IP address but virtual host config and worker-properties config in Apache were prior to dbconfig.xml and that's why test server tried to connect to the production database.

Problem solved ! Now I can try to migrate Jira to the newest version on the test server.

1 vote

jira.home must be pointing to some other home directory. It can be set by system property, or in jira-application.properties... check both of those.

Or for a quick check make dbconfig.xml invalid by removing some xml tag, and make sure you get an error about that on startup.

The other possibility is that you also have a JNDI name in dbconfig.xml, with the datasource defined in your server.xml, but seems unlikely.

Did you try restarting the test instance so that the changes in dbconfig.xml is picked up?

Rahul

I've found there are two dbconfig.xml files on the server !

One in jira directory and one in data directory and the real one is the second one !

Right, so my answer was basically correct.

In fact, it's not OK !

I've changed url in jira/dbconfig.xml, in data/jira/dbconfig.xml and in jira/atlassian-jira/WEB-INF/classes/database-defaults/mysql.properties but after restarting Jira, it still shows this ural in administration/system/troubleshooting and support/system informations :

Adresse JNDI de la base de données mysql jdbc:mysql://mydbserver:3306/jira?useUnicode=true&characterEncoding=UTF8&sessionVariables=storage_engine=InnoDB
URL de la base de données

jdbc:mysql://mydbserver:3306/jira?useUnicode=true&characterEncoding=UTF8&sessionVariables=storage_engine=InnoDB

In witch file is defined JNDI database address ?

I've renamed the two dbconfig.xml files and restarted Jira and Jira started with the JNDI and URL given in my previous message !

So these values are recorded somewhere else but where ?

I finally found where was the problem !

Production server is configured to access website by a classical URL instead of :8080 port. When copying the production server to replace the test one, production config has been copied too. I access test server by its IP address but virtual host config and worker-properties config in Apache were prior to dbconfig.xml and that's why test server tried to connect to the production database.

Problem solved ! Now I can try to migrate Jira to the newest version on the test server.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,314 views 14 20
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot