If you like what I do, you can support this channel by buying me a coffee. I would be grateful for your contribution! Your donations will help me create more FREE online courses and learning materials for programmers and remote workers.
In this article, we will demonstrate how we can run a MySQL instance on docker and connect a Java application on it using JDBC.
While this exercise is done using a MySQL instance running on Docker, it can be run in a locally installed MySQL database as well.
2.) Prerequisites
Prior knowledge of existing technologies such as virtualization, eclipse ide is needed to follow this exercise. For those who are not familiar with these technologies, I recommend visiting the reference section below that points to various tutorials I have written related to it.
Eclipse IDE
GIT
MySQL Workbench Community
Docker
2.1) Running MySQL on Docker
Docker is a virtualization tool that we can use to run an application such as MySQL without actually installing it.
To install Docker, follow the guide in the link in the reference section.
To run docker, open your terminal and execute:
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=kerri -e MYSQL_DATABASE=catalog mysql
2.2) MySQL Workbench Installation
WorkBench installation is straight-forward for Windows, you just have to download the installer from the link below and connect to your database.
On the other hand, there are some configurations/installations that you need to perform in Debian machines to install it. See the link in the reference section below.
Once the WorkBench is running you can then connect to your database with the password you entered when you run MySQL with docker. In our case, we used 'kerri'.
By default, the database catalog will be created. Double click on it in the Schema tab so that it is selected and then press the "Create a new SQL tab..." button and enter the script in "src/main/resources/1 - schema.sql" to create our product table.
3.) Cloning the Project
You can either clone the project using the Eclipse EGIT plugin or via terminal.
Are you looking for freelancers in the Philippines? Get in touch.
Donations
If you like what I do, you can support this channel by buying me a coffee. I would be grateful for your contribution! Your donations will help me create more FREE online courses and learning materials for programmers and remote workers.
If you like what I do, you can support this channel by buying me a coffee. I would be grateful for your contribution! Your donations will help me create more FREE online courses and learning materials for programmers and remote workers.
Post a Comment