Skip to content

Latest commit

 

History

History
78 lines (57 loc) · 4.19 KB

README.md

File metadata and controls

78 lines (57 loc) · 4.19 KB

SQL-Examples

A Maven project containing examples for connecting to a database, running stored procedures, triggers, and etc. This project uses the MySQL example database "sakila", please review the Files section below to obtain the database.

❈ Requirements

  • Java Development Kit 14
  • MySQL Community Server 8
  • Java IDE (ex. Eclipse or IntelliJ IDEA Community)

❈ Download and Install

▣ Java Development Kit 14

  1. Download and install JDK 14.

▣ MySQL Community Server 8

  1. Download MySQL Community Server 8
    NOTE: For Windows, click on 'MySQL Installer for Windows', otherwise, click on 'MySQL Community Server'.

  2. Install MySQL Community. Please follow this installation guide for help.

❈ Setting up and Configuring

▣ Importing to Eclipse

  1. Open Eclipse IDE.

  2. Click File in the toolbar at the top.

  3. Click Import...

  4. In the pop-up, click the Git folder in the center section.

  5. Click Projects from Git (with smart import).

  6. Click Next at bottom of the current window.

  7. Click Clone URI and click Next

  8. Paste "https://github.com/katkeit/SQL-Examples" into URI section and click Next.
    NOTE: The window will fill out some sections automatically.

  9. Click Next.

  10. Ensure the directory path is where you want the project to store. Click Next.

  11. Click Finish.

▣ Importing to IntelliJ IDEA Community

  1. Open IntelliJ IDEA Community.
    NOTE: If any existing projects are open, click File in the toolbar at the top, and click Close Project.

  2. On the right-hand side of the IntelliJ IDEA launcher click "Get from Version Control".
    NOTE: This window will automatically appear if all currently opened projects are closed.

  3. On the left side of the window make sure Repository URL is selected.

  4. In the center, copy and paste "https://github.com/katkeit/SQL-Examples" into the URL box.

  5. Confirm where you want the files to clone to in the Directory box.

  6. Click Clone at the bottom.

▣ Configuring IntelliJ IDEA Community

➤ Selecting Project SDK

  1. With the project open, go to File, and click 'Project Structure...'.

  2. In the Project Structure window, and click the Project tab inside the Project Settings section on the left.

  3. In the middle section of the window, under the Project SDK section, click the drop down menu, and select 'java version 14'.

  4. Click the OK button at the bottom of the window.

▣ Configuring MySQL Community Server 8

  1. Open MySQL Workbench 8
    NOTE: For users using command line, please follow this guide to restore the database.

  2. Double-click on your 'Local instance MySQL80' and enter your root password. The root password would have been created during installation.
    NOTE: To reset your root password on Windows, follow this guide. For Linux users, please follow this guide.

  3. In the Navigator window, click the Administrator tab at the bottom of the window, and click 'Data Import/Restore'.

  4. In the 'Import Options' section, select 'Import from Self-Contained File', and browse for the 'sakila-schema.sql' file.
    NOTE: You need to download the 'sakila database' zip file from the link in the File section below.

  5. At the bottom, click 'Start Import' button.
    NOTE: Once the import is complete, then you can close the tab.

  6. Repeat Step 4 and 5, but browse for the 'sakila-data.sql' file instead.

  7. In the Navigator menu, click the Schemas tab at the bottom, click the refresh button near the top, and 'sakila' database should appear.

❈ Files

  1. MySQL Example Database - Sakila
    NOTE: Follow the "Configuring MySQL Community Server 8" guide inside the "Setting up and Configuring" section above.