# Missing JDBC Driver

**URL:** <https://discuss.circleci.com/t/missing-jdbc-driver/22474>\
**Category:** Databases\
**Tags:** mysql, circle-yml\
**Created:** [May 22, 2018, 1:14am UTC](https://discuss.circleci.com/t/missing-jdbc-driver/22474 "2018-05-22T01:14:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwinteringham](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mwinteringham/32/18450_2.png) [@mwinteringham](https://discuss.circleci.com/u/mwinteringham)\
**Post date:** [May 22, 2018, 1:14am UTC](https://discuss.circleci.com/t/missing-jdbc-driver/22474/1 "2018-05-22T01:14:48Z")

</div>

Hello all,

New to CircleCI but enjoying working with it so far. However, I have run into an issue with my Java API when it starts up for integration testing. During its initialisation, the API connects to a MySQL DB but every time I start it up I am getting this error:

> Failed to instantiate [api.BookingController]: Constructor threw exception; nested exception is java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

I’ve tried adding the following to kick start things:

> Class.forName(“com.mysql.jdbc.Driver”);

Which returns the error you see above. I have also run:

> sudo apt-get install libmysql-java

Neither of these things fixed the issue. I have also confirmed that the DB is accessible with mysql-client. Can anyone help, feel like I am missing something obvious.

CircleCi config below

> run\_integration\_tests:

```
docker:
  - image: circleci/openjdk:8u151-jdk-node-browsers
    environment:
      - MYSQL_DATABASE: "rbp"
      - MYSQL_HOST: "127.0.0.1"
  - image: circleci/mysql:5.7
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: yes
      MYSQL_ROOT_PASSWORD: 'password'

environment:
    MAVEN_OPTS: -Xmx3200m

steps:
  - restore_cache:
      key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}

  - run:
      command: |
        dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
        mysql -h 127.0.0.1 -u root -ppassword < db/setup.sql

  - run:
      command: mvn integration-test
      working_directory: integration-tests

```

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [May 22, 2018, 9:27pm UTC](https://discuss.circleci.com/t/missing-jdbc-driver/22474/2 "2018-05-22T21:27:04Z")

</div>

> [@mwinteringham](#):
>
> I have also run:
> 
> ```
> sudo apt-get install libmysql-java
> 
> ```

It does not seem to be in your config file, though?

---

<div class="post-metadata">

**Author:** ![mwinteringham](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mwinteringham/32/18450_2.png) [@mwinteringham](https://discuss.circleci.com/u/mwinteringham)\
**Post date:** [May 23, 2018, 4:20pm UTC](https://discuss.circleci.com/t/missing-jdbc-driver/22474/3 "2018-05-23T16:20:34Z")

</div>

Apologies, that was run during an SSH session to test it out.

I worked out the issue isn’t CircleCI related though and that the way I was starting the API within my integration tests was what was causing the issue. So I moved the startup of the APIs to a shell script and it all worked fine and dandy 🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [August 21, 2018, 4:20pm UTC](https://discuss.circleci.com/t/missing-jdbc-driver/22474/4 "2018-08-21T16:20:39Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
