Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL configuration #24

Open
hackery opened this issue Feb 26, 2019 · 4 comments
Open

MySQL configuration #24

hackery opened this issue Feb 26, 2019 · 4 comments

Comments

@hackery
Copy link

hackery commented Feb 26, 2019

The main README includes this comment (inherited from spring-petclinic ?) but the code and comments seem to have diverged:

A similar setup is provided for MySql ...

There's no main/resources/application-mysql.properties for example. I'm trying to run this using the Docker image arey/springboot-petclinic adding in a likely properties file and hacking the classpath, but it's then failing with:

java.sql.SQLException: Unable to load class: com.mysql.jdbc.Driver

Is it missing the mysql-connector-java artifact? I've been looking to add the driver post-hoc but having trouble finding something suitable in the Alpine repo, or shoehorning changes into the startup. I'd rather find a repackaging solution than start hacking the build myself ...

@arey arey added the question label Feb 26, 2019
@arey
Copy link
Member

arey commented Feb 26, 2019

Hi @hackery. Yes, this angularjs repository is a fork of the one you reference.
The MySQL support (code and documentation) has to be improve. If you are interested, I could work on it in the next days/weeks.

First, you may try to add the mysql-connecter-java artifact to the spring-petclinic-server/pom.xml

    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <scope>runtime</scope>
    </dependency>

You should rebuild the project and the Docker image.
I suppose there is also some lines to change in the application.properties file.

@arey
Copy link
Member

arey commented Feb 28, 2019

Hi @hackery. I've reworked the MySQL configuration. Please have a look on my commit
9a565ab
I hope this help you to use MySQL.

@hackery
Copy link
Author

hackery commented Feb 28, 2019

[ ah - wrote this before seeing your update above - I'll check out the commit, tyvm ]
Yes, I'm interested, if you have time to spare on it. I can send you whatever feedback might be useful.
I've managed to bodge the mysql-connector into the runtime environment -

  • Docker volume mapping of mysql-connector-java-5.1.47-bin.jar from dev.mysql.com
  • some classpath/invocation trickery
  • added an application-mysql.properties file with some likely overrides for the db type, schema paths and db uri/credentials.

arey added a commit that referenced this issue Mar 1, 2019
@arey
Copy link
Member

arey commented Mar 1, 2019

I've published a docker-compose.yml file that start the Petclinic application with a MySQL database. The readme.md has been completed with a Docker usage documentation.
Finally, I've published a new Docker image into https://cloud.docker.com/u/arey/repository/docker/arey/springboot-petclinic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants