Error connecting to database

Dianna Newman June 27, 2017

I am reinstalling Jira to our new Linux server and I got this error:

Error connecting to database

Cannot load connection class because of underlying exception: com.mysql.cj.core.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near '=InnoDB'.

Originally it said that the mysql connector file was missing so I put 'mysql-connector-java-6.0.6.jar' into the lib folder as directed. Now I have a new error that I just don't know how to fix. I have set up a brand new database.

3 answers

9 votes
René Link September 16, 2017

I had the same problem.

In my case I was using the wrong driver version.

I used version 6.0.6, but the correct version is 5.1.44

Take a look at the documentation about Copy the MySQL JDBC driver to your application server

The documentation says

  • If you are installing JIRA, download the recommended MySQL driver JDBC Connector/J 5.1. You can download either the .tar.gz or the .zip file by selecting the 'Platform Independent' option. Extract the jar for the driver (e.g. mysql-connector-java-5.x.x-bin.jar) from the archive.

I downloaded the driver from the central maven repository: mysql » mysql-connector-java

using

wget http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.44/mysql-connector-java-5.1.44.jar

 

 

 

 

 

Media Matters May 9, 2018

Thanks! I got same error and the old mysql-connector-java-5.1.46.jar fixed it.

I'm setting up Jira on Ubuntu 16.04, MySQL 5.7 all dancing on VMware. 

I'm thinking the documentation isn't clearly stating, "please use the old drivers". I ran into the same scenario setting up Conflunence, it wanted an old driver.

Thanks again for this post.

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 28, 2017

You've given the setup an incorrect or badly formed url when ytying to connect.  We need to see that.

Depending on how far through the install you've got, there are two possibilities.

1.  There's a file in your JIRA home directory called dbconfig.xml which has the connection settings in it.  We just need to see the connection string out of that, not username and password etc.

2.  What are you entering when the system asks you for the database connection details

Dianna Newman June 28, 2017

I don't see any dbconfig.xml file under Jira. I see a lock file.

Here is a photo from my screen

Screen.jpg

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 28, 2017

Ok, it's not been able to connect, so it has not created the dbconfig file.  I sort of expected that, but had to check.

The parameters you are entering look good to me, so I'm not sure what is wrong.

Next thing to do is a look at the log file, which should tell us the full reason for the failure and contain the string it has constructed to try the connection.  Should be under "logs" in the directory you found the lock file.

Dianna Newman July 1, 2017
 ---------------------------------------------------------------------------------
      Heap memory     :  Used:  125 MiB.  Committed:  491 MiB.  Max:  734 MiB
      Non-heap memory :  Used:   65 MiB.  Committed:   67 MiB.  Max: 1264 MiB
    ---------------------------------------------------------------------------------
      TOTAL           :  Used:  190 MiB.  Committed:  558 MiB.  Max: 1998 MiB
    ---------------------------------------------------------------------------------
2017-07-02 01:37:16,262 http-nio-8080-exec-17 ERROR anonymous 97x22x1 1y1dl5o 98.24.51.78 /secure/SetupDatabase!connectionCheck.jspa [c.a.config.bootstrap.DefaultAtlassianBootstrapManager] Could not successfully test your database: 
java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.core.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near '=InnoDB'.
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:526)
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505)
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479)
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:489)
 at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:72)
 at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:124)
 at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:224)
 at java.sql.DriverManager.getConnection(DriverManager.java:664)
 at java.sql.DriverManager.getConnection(DriverManager.java:247)
 at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.getTestDatabaseConnection(DefaultAtlassianBootstrapManager.java:347)
 at com.atlassian.jira.config.database.JdbcDatasource.getConnection(JdbcDatasource.java:211)
 at com.atlassian.jira.config.database.DatabaseConfig.testConnection(DatabaseConfig.java:87)
 at com.atlassian.jira.web.action.setup.SetupDatabase.testConnection(SetupDatabase.java:225)
 at com.atlassian.jira.web.action.setup.SetupDatabase.doValidation(SetupDatabase.java:189)
 at com.atlassian.jira.web.action.setup.SetupDatabase.doConnectionCheck(SetupDatabase.java:121)
 ... 3 filtered
 at java.lang.reflect.Method.invoke(Method.java:498)
 at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:70)
 at webwork.util.InjectionUtils.invoke(InjectionUtils.java:56)
 ... 2 filtered
 at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:63)
 ... 7 filtered
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
 ... 48 filtered
 at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:70)
 ... 73 filtered
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 at java.lang.Thread.run(Thread.java:745)
Caused by: com.mysql.cj.core.exceptions.UnableToConnectException: Cannot load connection class because of underlying exception: com.mysql.cj.core.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near '=InnoDB'.
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:54)
 ... 152 more
Caused by: com.mysql.cj.core.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near '=InnoDB'.
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:54)
 at com.mysql.cj.core.conf.url.ConnectionUrlParser.parseQuerySection(ConnectionUrlParser.java:491)
 at com.mysql.cj.core.conf.url.ConnectionUrlParser.getProperties(ConnectionUrlParser.java:616)
 at com.mysql.cj.core.conf.url.ConnectionUrl.collectProperties(ConnectionUrl.java:307)
 at com.mysql.cj.core.conf.url.ConnectionUrl.<init>(ConnectionUrl.java:292)
 at com.mysql.cj.core.conf.url.SingleConnectionUrl.<init>(SingleConnectionUrl.java:38)
 at com.mysql.cj.core.conf.url.ConnectionUrl.getConnectionUrlInstance(ConnectionUrl.java:202)
 at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:194)
 ... 151 more
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 2, 2017

Ok. Can you look back through the log from there?  You should find a line in it that says "Database URL" - what does that say?

0 votes
René Link September 16, 2017

I had the same problem. In my case I was using the wrong driver version. I used 6.0.6.

The version that works for me is 5.1.44.

Take a look at the documentation Copy the MySQL JDBC driver to your application server

It says:

  • If you are installing JIRA, download the recommended MySQL driver JDBC Connector/J 5.1. 
    You can download either the .tar.gz or the .zip file by selecting the 'Platform Independent' option. Extract the jar for the driver (e.g. mysql-connector-java-5.x.x-bin.jar) from the archive.

I downloaded the driver from the central maven repository:

using

wget http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.44/mysql-connector-java-5.1.44.jar

Suggest an answer

Log in or Sign up to answer