# SDK: ???Unable to connect to database???

**URL:** <https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666>\
**Category:** Implementing\
**Tags:** openmrs-sdk\
**Created:** [June 4, 2021, 2:07pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666 "2021-06-04T14:07:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndacyayisenga](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ndacyayisenga/32/20176_2.png) [@ndacyayisenga](https://talk.openmrs.org/u/ndacyayisenga)\
**Post date:** [June 4, 2021, 2:07pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/1 "2021-06-04T14:07:09Z")

</div>

![Screenshot from 2021-06-04 16-55-49](https://talk.openmrs.org/uploads/default/original/2X/4/4b1663e1b19f20381b5fe6d2fb6a29828c09a5ab.png)

am currently running ubuntu 20.4, Server version: 5.7.34 MySQL, I have selected to run a **Distribution** having \*\*Reference application 2.11.0, mysql server is up running but i would like to know why am really landing into this error of my database not connecting… the error log can be found [ndacyayisenga@ndacyayisenga-OptiPlex-3010:~$ mvn openmrs-sdk:run[INFO] Scannin - Pastebin.com](https://pastebin.com/x1qxaFqs)

cc @jwnasambu@reagan@dkayiwa @sharif@mozzy

---

<div class="post-metadata">

**Author:** ![piumal1999](https://talk.openmrs.org/user_avatar/talk.openmrs.org/piumal1999/32/13557_2.png) [@piumal1999](https://talk.openmrs.org/u/piumal1999)\
**Post date:** [June 4, 2021, 4:53pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/2 "2021-06-04T16:53:30Z")

</div>

Hi @ndacyayisenga , I hope this thread will help you:

> [@???Unable to connect to database??????](https://talk.openmrs.org/t/unable-to-connect-to-database/33513):
>
> Hi everyone I am new to openMrs. I have been trying to install openMrs by using OpenMRS SDK for many days because i want to start contributing and i have been facing many issues and I have been reading many answers but no answer has helped me to solve my issue. I have followed the instructions in the SDK development installation and every thing has worked well until the last stage. problem description. First step: I install SDK by using command ‘mvn org.openmrs.maven.plugins:openmrs-sdk-maven-pl…

---

<div class="post-metadata">

**Author:** ![herbert24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/herbert24/32/8178_2.png) [@herbert24](https://talk.openmrs.org/u/herbert24)\
**Post date:** [June 5, 2021, 8:26am UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/3 "2021-06-05T08:26:52Z")

</div>

are you able to login to your database via terminal? @ndacyayisenga

---

<div class="post-metadata">

**Author:** ![ndacyayisenga](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ndacyayisenga/32/20176_2.png) [@ndacyayisenga](https://talk.openmrs.org/u/ndacyayisenga)\
**Post date:** [June 8, 2021, 11:29am UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/4 "2021-06-08T11:29:28Z")

</div>

yes @herbert24 but all in vain

---

<div class="post-metadata">

**Author:** ![jwnasambu](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jwnasambu/32/13543_2.png) [@jwnasambu](https://talk.openmrs.org/u/jwnasambu)\
**Post date:** [June 8, 2021, 11:33am UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/5 "2021-06-08T11:33:17Z")

</div>

Kindly you can also share the error logs on the terminals using pastebin.

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [June 8, 2021, 12:54pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/6 "2021-06-08T12:54:05Z")

</div>

What is the output of `mvn -v`?

---

<div class="post-metadata">

**Author:** ![ndacyayisenga](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ndacyayisenga/32/20176_2.png) [@ndacyayisenga](https://talk.openmrs.org/u/ndacyayisenga)\
**Post date:** [June 8, 2021, 1:01pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/7 "2021-06-08T13:01:56Z")

</div>

> [@ibacher](#):
>
> What is the output of `mvn -v` ?

Apache Maven 3.6.3 Maven home: /usr/share/maven Java version: 1.8.0\_292, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre Default locale: en\_US, platform encoding: UTF-8 OS name: “linux”, version: “5.4.0-26-generic”, arch: “amd64”, family: "unix@ibacher

---

<div class="post-metadata">

**Author:** ![ndacyayisenga](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ndacyayisenga/32/20176_2.png) [@ndacyayisenga](https://talk.openmrs.org/u/ndacyayisenga)\
**Post date:** [June 8, 2021, 1:04pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/8 "2021-06-08T13:04:35Z")

</div>

> [@jwnasambu](#):
>
> Kindly you can also share the error logs on the terminals using pastebin.

@jwnasambu

[ndacyayisenga@ndacyayisenga-OptiPlex-3010:~$ mvn openmrs-sdk:run[INFO] Scannin - Pastebin.com ](https://pastebin.com/x1qxaFqs)

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [June 8, 2021, 1:10pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/9 "2021-06-08T13:10:43Z")

</div>

The issue you are having seems to be the same as the one in [this StackOverflow post](https://stackoverflow.com/questions/67234640/after-upgrading-to-java-8u292-tls-connection-fails-with-sslhandshakeexception) and the fix is probably the same, i.e., add `&enabledTLSProtocols=TLSv1.2` to the end of your JDBC connection string.

To change the JDBC connection string, go to `~/openmrs/myserver`, open the file `openmrs-runtime.properties` in a text editor. Find the line that starts `connection.url=` and add `&enabledTLSProtocols\=TLSv1.2` to the end of the connection string.

---

<div class="post-metadata">

**Author:** ![ndacyayisenga](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ndacyayisenga/32/20176_2.png) [@ndacyayisenga](https://talk.openmrs.org/u/ndacyayisenga)\
**Post date:** [June 8, 2021, 2:09pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/10 "2021-06-08T14:09:18Z")

</div>

> [@ibacher](#):
>
> The issue you are having seems to be the same as the one in [this StackOverflow post](https://stackoverflow.com/questions/67234640/after-upgrading-to-java-8u292-tls-connection-fails-with-sslhandshakeexception) and the fix is probably the same, i.e., add `&enabledTLSProtocols=TLSv1.2` to the end of your JDBC connection string.
> 
> To change the JDBC connection string, go to `~/openmrs/myserver` , open the file `openmrs-runtime.properties` in a text editor. Find the line that starts `connection.url=` and add `&enabledTLSProtocols\=TLSv1.2` to the end of the connection string.

Thanks @ibacher this works fine… Thankyou

 ![Screenshot from 2021-06-08 17-09-50](https://talk.openmrs.org/uploads/default/original/2X/2/2a25b5109f5d7207b194d3d5fd60e80fa7dafabd.png)

---

<div class="post-metadata">

**Author:** ![atiq](https://talk.openmrs.org/user_avatar/talk.openmrs.org/atiq/32/14179_2.png) [@atiq](https://talk.openmrs.org/u/atiq)\
**Post date:** [August 18, 2021, 11:13am UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/11 "2021-08-18T11:13:18Z")

</div>

Hi @ibacher followed the steps but not able to connect with database .

---

<div class="post-metadata">

**Author:** ![ndacyayisenga](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ndacyayisenga/32/20176_2.png) [@ndacyayisenga](https://talk.openmrs.org/u/ndacyayisenga)\
**Post date:** [August 18, 2021, 11:24am UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/12 "2021-08-18T11:24:15Z")

</div>

Hey @atiq what are the logs saying?

---

<div class="post-metadata">

**Author:** ![atiq](https://talk.openmrs.org/user_avatar/talk.openmrs.org/atiq/32/14179_2.png) [@atiq](https://talk.openmrs.org/u/atiq)\
**Post date:** [August 18, 2021, 12:03pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/13 "2021-08-18T12:03:20Z")

</div>

Thanks @ndacyayisenga for response. Its giving me java.sql.SQLException: Access denied for user ‘root’@‘localhost’ (using password: YES)

---

<div class="post-metadata">

**Author:** ![jwnasambu](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jwnasambu/32/13543_2.png) [@jwnasambu](https://talk.openmrs.org/u/jwnasambu)\
**Post date:** [August 18, 2021, 12:05pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/14 "2021-08-18T12:05:03Z")

</div>

> [@atiq](#):
>
> ‘root’@‘localhost’ (using password: YES)

Is `YES` your mysql root password?

---

<div class="post-metadata">

**Author:** ![atiq](https://talk.openmrs.org/user_avatar/talk.openmrs.org/atiq/32/14179_2.png) [@atiq](https://talk.openmrs.org/u/atiq)\
**Post date:** [August 18, 2021, 12:06pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/15 "2021-08-18T12:06:18Z")

</div>

Yes its set to root

---

<div class="post-metadata">

**Author:** ![ndacyayisenga](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ndacyayisenga/32/20176_2.png) [@ndacyayisenga](https://talk.openmrs.org/u/ndacyayisenga)\
**Post date:** [August 18, 2021, 12:09pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/16 "2021-08-18T12:09:42Z")

</div>

> [@atiq](#):
>
> Thanks @ndacyayisenga for response. Its giving me java.sql.SQLException: Access denied for user ‘root’@‘localhost’ (using password: YES)

```auto

```

Are you able to access you mysql in the terminal. I mean something like this

```auto
ndacyayisenga@ndacyayisenga-OptiPlex-3010:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 156
Server version: 5.7.34 MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

```

```auto

```

```auto

```

---

<div class="post-metadata">

**Author:** ![atiq](https://talk.openmrs.org/user_avatar/talk.openmrs.org/atiq/32/14179_2.png) [@atiq](https://talk.openmrs.org/u/atiq)\
**Post date:** [August 18, 2021, 12:10pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/17 "2021-08-18T12:10:36Z")

</div>

Yes I can access my sql through terminal as well.

---

<div class="post-metadata">

**Author:** ![ndacyayisenga](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ndacyayisenga/32/20176_2.png) [@ndacyayisenga](https://talk.openmrs.org/u/ndacyayisenga)\
**Post date:** [August 18, 2021, 12:13pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/18 "2021-08-18T12:13:00Z")

</div>

> [@atiq](#):
>
> I am using 5.7.32

At what exact point does this fail… When you input password for mysql or it fails in the browser?

---

<div class="post-metadata">

**Author:** ![atiq](https://talk.openmrs.org/user_avatar/talk.openmrs.org/atiq/32/14179_2.png) [@atiq](https://talk.openmrs.org/u/atiq)\
**Post date:** [August 18, 2021, 12:14pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/19 "2021-08-18T12:14:13Z")

</div>

I am using 5.7.32

---

<div class="post-metadata">

**Author:** ![ndacyayisenga](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ndacyayisenga/32/20176_2.png) [@ndacyayisenga](https://talk.openmrs.org/u/ndacyayisenga)\
**Post date:** [August 18, 2021, 12:18pm UTC](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666/20 "2021-08-18T12:18:10Z")

</div>

> [@ibacher](#):
>
> To change the JDBC connection string, go to `~/openmrs/myserver` , open the file `openmrs-runtime.properties` in a text editor. Find the line that starts `connection.url=` and add `&enabledTLSProtocols\=TLSv1.2` to the end of the connection string.

@atiq did you take a look at that

[Next page](https://talk.openmrs.org/t/sdk-unable-to-connect-to-database/33666.md?page=2)
