-
Notifications
You must be signed in to change notification settings - Fork 61
Getting Started ‐ Phase 4
The Starter Code has three folders, resources, dataaccess, and passoff/server. Complete the following steps to move the starter code into your project for this phase.
- Open your chess project directory.
- Copy the
starter-code/4-database/resources/db.propertiesfile into your project’sserver/src/main/resourcesfolder. This contains your database configuration settings. You will need to replace the values with your database username and password. - Copy the
starter-code/4-database/dataaccess/DatabaseManager.javafile from the starter-code into your project'sserver/src/main/java/dataaccessfolder. This contains code that will read your database configuration settings and create connections to your database server. - Copy the
starter-code/4-database/passoff/server/DatabaseTests.javafile into your project’sserver/src/test/java/passoff/serverfolder. This contains a test that makes sure you are persisting information to your database.
This should result in the following additions to your project.
└── server
└── src
├── main
│ ├── java
│ │ └── dataaccess
│ │ └── DatabaseManager.java
│ └── resources
│ └── db.properties
└── test
└── java
└── passoff
└── server
└── DatabaseTests.javaThere is a lot of 3rd party code that you can download and include in your Java applications. As part of the Phase 0 starter Chess project, we already included packages that run your tests (JUint), serialize JSON (Gson), handle logging (Slf4j), and make HTTP network requests (Javalin).
We use a cloud based package repository called Maven to manage our dependencies. All of the starter chess dependencies were pull from Maven and included in the project. You can view these dependencies using IntelliJ by opening the Project Structure dialog, going to the modules tab, and selecting the server module.

Now you need to include some additional dependencies in order to connect to your MySQL database server and hash your passwords. From the Project Structure dialog select the module you wish to add a dependency to. Press the + button and select Library/from Maven.... You then supply the name of the library you want to download. Once it is added, you can specify the scope for the dependency. Most dependencies for this class will be with scope "compile", meaning that the dependency is available to all the code in the module when it compiles. There are a few others, including "test", which means it is only available for code used to test the code in the module.
Add the dependency for the MySQL driver and BCrypt. Associate them with your server module.
-
com.mysql:mysql-connector-j:9.4.0
- Scope: Compile
-
org.mindrot:jbcrypt:0.4
- Scope: Compile