Pay attention to the three modules:
- client - a simple client built using JavaFX and OCSF. We use EventBus (which implements the mediator pattern) in order to pass events between classes (in this case: between SimpleClient and PrimaryController.
- server - a simple server built using OCSF.
- entities - a shared module where all the entities of the project live.
- Create a docker image.
- Run Maven install in the parent project. (Create new goal "clean install" on the entire folder)
- Run the server using the exec:java goal in the server module. (Create goal "exec:java" only on the server folder)
- Run the client using the javafx:run goal in the client module. (Create goal "javafx:run" only on the client folder)
- Press the button and see what happens!
- Run the server using goal "clean compile assembly:single"
- Run the client using goal "clean package"
- The jar files should appear under target in the respective folders.
- Use client-SNAPSHOT and server-SNAPSHOT-with-dependencies jars.
- To run the JARS: run java -jar {jar_file} in 2 separate command prompts.
Lab 6 recording shows how it's done around minute 25. The gist of it:
- Make sure you have Docker Desktop on your computer and "docker" recognized as a command prompt command.
- Run in the command prompt: docker run --name demo-mysql -e MYSQL_ROOT_PASSWORD=ppppassword -p 3306:3306 -d mysql:8.0
- Run in the command prompt: docker exec -it demo-mysql mysql -u root -p
- After logging on, you can see databases by running "show databases;". Create a database called example: "create database MovieDb;".
- Change the hibernate properties password to match the one chosen when downloading Docker Desktop.
- If needed, change other properties to match the database name you chose.
You're now set (haha probably not. but the last sentence might help you, and for sure the nice people on stack overflow answered it for someone else 7 years ago). Run "use database MovieDb;" and you can see tables by "show tables;". To see a table's contents, run "select * from {table_name};".
Step 2 could be problematic. If it says the port it already used, make sure Docker Desktop doesn't have another image of a database open under a different name on the same port. You may have to go to the task manager and stop the process "mysqld.exe".