Database connection problems with SDK

Application Name: Reference Application Version Number: 2.6.0-SNAPSHOT

Question: Hi, I’m a new user of OpenMRS. When I tried to install the distribution via the SDK I encountered the problem that OpenMRS cannot connect to my MySQL Server (error in http://localhost:8080/openmrs/initialsetup).

Here is my openmrs-server.properties: #Thu May 04 10:43:46 CEST 2017 admin_user_password=Admin123 omod.legacyui=1.3.1 debug.port=1044 omod.metadatadeploy=1.8.1 omod.reportingrest=1.8.0 omod.owa=1.7.0 install_method=auto omod.serialization.xstream.type=omod omod.serialization.xstream=0.2.12 omod.registrationapp=1.8.0 has_current_openmrs_database=true tomcat.port=8080 omod.event.groupId=org.openmrs omod.event=2.5 omod.atlas.type=omod omod.uilibrary=2.0.4 omod.htmlwidgets=1.9.0 omod.dataexchange=1.3.2 database_name=distro1 add_demo_data=false name=Reference Application omod.appui=1.8.0 omod.allergyui=1.7.0 omod.providermanagement=2.6.0 omod.appointmentschedulingui=1.6.0 omod.formentryapp=1.4.1 omod.idgen=4.4.1 create_database_user=false omod.metadatamapping=1.3.2 omod.chartsearch=2.0 omod.htmlformentryui=1.6.4-SNAPSHOT create_tables=false omod.referencedemodata=1.4.3 omod.emrapi=1.21.0 connection.password=Admin123 omod.referenceapplication=2.6-SNAPSHOT connection.username=root server.id=distro1 distro.groupId=org.openmrs.distro omod.htmlformentry=3.3.2 omod.appframework=2.10.0 omod.referencemetadata=2.6.0 omod.coreapps=1.13.0 omod.reportingui=1.3.0 omod.reportingcompatibility=2.0.2 omod.reporting=1.12.0 omod.adminui=1.2.2 omod.registrationcore=1.7.1 omod.appointmentscheduling=1.8.0 auto_update_database=false war.openmrs=2.0.5 connection.driver_class=com.mysql.jdbc.Driver omod.calculation=1.2 omod.webservices.rest=2.19.0 omod.atlas=2.2 version=2.6.0-SNAPSHOT omod.uicommons=2.3.0 module_web_admin=true omod.uiframework=3.11.0 distro.artifactId=referenceapplication-package connection.url=jdbc:mysql://localhost:3306/distro1?autoReconnect=true&sessionVariables=storage_engine%3DInnoDB&useUnicode=true&characterEncoding=UTF-8 omod.metadatasharing=1.2.2

I can connect without a problem to my MySQL server with password Admin123 via the command: mysql -h localhost -P 3306 --protocol=tcp -u root -p

I also see the database ‘distro1’ there.

Thanks for helping me out, Victor

1 Like

Can we look at the failure stack trace? It will also help if you tell us what options you are choosing for the setup wizard in the browser.

Here is the stack trace:

OpenMRS is not able to start. The following error occurred at startup: Error occurred while trying to get the updates needed for the database. Unable to get a connection to the database. Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set java.lang.RuntimeException: Error occurred while trying to get the updates needed for the database. Unable to get a connection to the database. Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:627) at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:583) at org.openmrs.util.DatabaseUpdater.updatesRequired(DatabaseUpdater.java:249) at org.openmrs.web.Listener.setupNeeded(Listener.java:222) at org.openmrs.web.Listener.contextInitialized(Listener.java:180) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.Exception: Unable to get a connection to the database. Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set at org.openmrs.util.DatabaseUpdater.getLiquibase(DatabaseUpdater.java:358) at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:612) … 17 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. 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.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920) at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2395) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2316) at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:834) at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47) 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.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:347) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at org.openmrs.util.DatabaseUpdater.getConnection(DatabaseUpdater.java:420) at org.openmrs.util.DatabaseUpdater.getLiquibase(DatabaseUpdater.java:355) … 18 more Caused by: java.sql.SQLException: Access denied for user ‘openmrs_user’@‘localhost’ (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1086) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:928) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1750) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1290) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2493) at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2334) … 32 more

See the server log for full output.

I chose to use an existing MySQL server, then I entered root/Admin123 for the login credentials.

The openmrs-runtime.properties file does not exist yet, I think that is why I am redirected to initialsetup?

Which installation method did you choose on the wizard?

i used distribution, then the top option, reference application 2.6

i created the sql server as a docker myself

i did not choose the mysql-docker option, since that lead to the same error in a first attempt

I was referring to the browser setup wizard.

I am sorry for stealing your time, my error was that I was running a different version of OpenMRS in parallel and got confused

do you intend to mean you got over the error ??

I guess he did

@vsaase he can post it here if he did.