Jira connects to the bad database

Philippe Leménager
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

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

0 votes
Answer accepted
Philippe Leménager
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2013

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
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

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.

0 votes
Philippe Leménager
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

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 ?
Philippe Leménager
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

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 ?

Philippe Leménager
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2013

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.

0 votes
Philippe Leménager
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

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 !

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

Right, so my answer was basically correct.

0 votes
Rahul Aich [Nagra]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

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

Rahul

Suggest an answer

Log in or Sign up to answer