Forums

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

Mantis import fails on Jira Software 7.10.0 due to invalid MySQL connection string

Mikael Eiman June 8, 2018

When I click "Next" on the first screen of the Mantis import, I get this error:

Error connecting to the database: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near '=InnoDB&autoReconnect=true&useUnicode=true&zeroDateTimeBehavior=convertToNull&useCursorFetch=true&defaultFetchSize=100'.

Looking in the log, I can see that the connection string used is:

jdbc:mysql://address=(protocol=tcp)(host=myserver.company.com)(port=3306)/mantis?useUnicode=true&characterEncoding=UTF8&sessionVariables=default_storage_engine=InnoDB&autoReconnect=true&useUnicode=true&zeroDateTimeBehavior=convertToNull&useCursorFetch=true&defaultFetchSize=100

To me it looks like there's a & (and maybe a value for sessionVaraibles) missing before the "default_storage_engine" option.

Is there any way to get manual control over the connection string used for the import? As far as I could tell the source code of the importer isn't open source.

2 answers

1 accepted

1 vote
Answer accepted
Axel Joester
Contributor
June 19, 2018

I had the same problem, when I had copied the driver mysql-connector-java-8.0.11.jar to <jira-installation-folder>/lib.

Problem went away, when I deleted that jar and copied the older driver mysql-connector-java-5.1.46.jar instead.

To get this older driver, go to https://dev.mysql.com/downloads/connector/j/  and then click on "Looking for previous GA versions?"

Mikael Eiman June 19, 2018

Thanks, that worked for me to!

Seems like the importer plugin needs to be updated to support the newer MySQL connector version.

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 19, 2018

Thanks @Axel Joester

That is something I did not think about here.  Jira does not yet support the 8.0 version of mysql or its 8.0 jdbc driver.   You can use the direct link to download the latest 5.1.x version instead https://dev.mysql.com/downloads/connector/j/5.1.html

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

Strange, perhaps there is a problem with the syntax here.   I noticed that your connection string is using single '&' characters to separate these parameters.  However the official Atlassian documentation on Connecting Jira to MySQL cites in the sample dbconfig.xml to use a '&amp;' for this separation instead of a single &.

I don't know for sure this is the cause, but I'd try to change your dbconfig.xml to more closely match the sample on that page, save your changes, and then restart Jira.

If you can still reproduce this problem after changing those settings, please let me know.  It might be a problem with how the importer plugin Jira is using is setup to understand these database parameters.

Or it might be that you are using other database connection parameters that can't be accounted for in the code right now.  If the first steps don't help, you might try to eliminate all the other strings temporarily to see if you can complete this import with just the values of

useUnicode=true&amp;characterEncoding=UTF8&amp;sessionVariables=default_storage_engine=InnoDB 

as in the guide.

Mikael Eiman June 11, 2018

My Jira database is using Postgres, it's the Mantis importer that tries to use MySQL. I don't think the importer gets its database connection string from dbconfig.xml; at least in my such file there's only my Postgres settings.

I did a quick search but couldn't find where the importer is installed and if there are any configuration files there that I could tweak. There is a feature to reuse an existing configuration file on the first step of the importer, but to do that I'd need to successfully get through the import once. I suppose if I had such a configuration file I could tweak the database connection string that should be part of it, but it seems like a catch 22 🤷‍♂️

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 13, 2018

Ah, thanks for clarifying.   What version of Mantis are you using?  Are you aware of what version the MySQL database that Mantis utilizes on the back end?

I ask because I searched this topic some more and I came across this issue: https://jira.atlassian.com/browse/JRASERVER-66458

It is a request to update Atlassians own documentation on this same kind of problem.  The importer plugin is a system plugin that is bundled with Jira installations.  That plugin is responsible for what options exist in this particular importer.  While there is an option to adjust additional JDBC strings, it does not appear that you can currently change this version of of that plugin to use a non - 'default_storage_engine' string.  That feature was something that MySQL 5.7 started forcing applications to define.  However older versions don't understand this string.  Since Jira itself can use mysql, there are specific configurations needed for Jira to connect to a mysql database and specific database versions that are supported with Jira.   I'm starting to think that Jira in 7.10.0 versions might not be able to connect to this Mantis databases running older mysql 5.1 or older versions of that database.

 

So it might very well be we need more than a documentation request here.  I am inclined to write up a bug for this problem, but I need more information to do that.  Please let me know more about your Mantis database version here.

Mikael Eiman June 14, 2018

Actually I think the primary problem isn't that I've got the wrong MySQL server version, since we don't get that far - the error occurs before even trying to connect.

Have a look at the connection string:

jdbc:mysql://address=(protocol=tcp)(host=myserver.company.com)(port=3306)/mantis?useUnicode=true&characterEncoding=UTF8&sessionVariables=default_storage_engine=InnoDB&autoReconnect=true&useUnicode=true&zeroDateTimeBehavior=convertToNull&useCursorFetch=true&defaultFetchSize=100

If we strip the address part and split the rest by "&" to get one parameter per line we get this:

/mantis?

useUnicode=true&

characterEncoding=UTF8&

sessionVariables=default_storage_engine=InnoDB&

autoReconnect=true&

useUnicode=true&

zeroDateTimeBehavior=convertToNull&

useCursorFetch=true&

defaultFetchSize=100

Note the part with "sessionVariables" - there's no "&" separating it from the "default_storage_engine" parameter.

Here's the MySQL server, for completeness:

> apt show mysql-server
Package: mysql-server
Source: mysql-5.5
Version: 5.5.59-0+deb8u1
Installed-Size: 125 kB
Maintainer: Debian MySQL Maintainers <pkg-mysql-maint@lists.alioth.debian.org>
Depends: mysql-server-5.5

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 15, 2018

I never meant to imply your version of MySQL was wrong, it probably is perfectly fine for the version of Mantis you have.  What I was trying to point out is just that Jira's importer plugin code is possibly not prepared to allow for Jira to connect to this database version, in this version of Jira.

I also came across this ticket https://jira.atlassian.com/browse/JRASERVER-64566

I am concerned that this might be directly related to the problem you have here.  In that case another user found that their Mantis MySQL database was not actually setup to use the InnoDB storage, but rather the previous MyISAM storage instead.   That works fine for Mantis, but Jira's import plugin code is specifically set to use the InnoDB storage engine string and it does not appear you can change this in Jira.   I'm not sure if that is by design (I can see a scenario where this is hardcoded intentionally to prevent other problems like data corruption), or if this is a bug.

From what I have found about this problem so far, I don't think there is anything you can do to alter this part of that connection string in Jira (short of hacking at the sourcecode of this importer plugin). 

Can you check to see what storage engine is used for this Mantis MySQL database?  InnoDB or MyISAM?

Michael Connell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 10, 2018

I have the same problem importing to Jira v7.4.3 from Mantis v1.2.15 on MySQL 5.1.36 and connecting using the mysql jdbc driver v5.1.46

Initially I get the error message "Error connecting to the database: Could not create connection to database server. Attempted reconnect 3 times. Giving up."

I confirmed that I had correct granted remote connection privileges and I was able to connect remotely using MySQL workbench.

Next, in the Mantis Import Wizard, Advanced, JDBC connection parameters, I removed 'AutoReconnect=true&' and then the error changed to:
"Error connecting to the database: Unknown system variable 'default_storage_engine'"

When I checked the MySQL server Variables, there is not one for default_storage_engine, rather it is storage_engine and it has a value of MyISAM 

Is it going to be possible to import form this version of MySQL? Note upgrading the MySQL database is not our preferred solution. 

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 11, 2018

Jira is not designed to use MySQL databases that use MyISAM, instead, it is expecting an InnoDB.   Given the errors you are seeing, I think this is the cause.   Granted I'm not sure which is expected for a Mantis database (MyISAM or InnoDB).

Perhaps you can take a clone of your existing mantis database, then change this clone to use the InnoDB instead, and then have Jira try to connect to that database instead here.

Suggest an answer

Log in or Sign up to answer