Skip to content

andreafra/Database-2-2021-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A marketing application with JEE and JPA (DataBases 2 class project)

A.Y. 2020 // Group 67 // Danelutti, Di Dio Lavore, Franchini

IntelliJ project with source code for the Databases 2 class optional project. The purpose is to deploy a Java EE application with a MySQL database.

Setup

You'll need to download the following tools:

  1. Clone this repository
git clone https://github.com/LucaDanelutti/db2-2020-Danelutti-DiDioLavore-Franchini
# or
gh repo clone LucaDanelutti/db2-2020-Danelutti-DiDioLavore-Franchini
  1. Download and uncompress TomEE somewhere
  2. Download and install MySQL
  3. Open the project folder with IntelliJ IDEA Ultimate
  4. In the menu bar, Run > Edit Configurations...
  5. Click '+' in the top left and select TomEE Server > Local
  6. If needed, click Configure... (beside Application Server) and point to the TomEE folder
  7. Select a TomEE version
  8. Leave everything else on default settings
  9. In the Deployment tab, under Deploy at the server startup click '+' and select Artifact... and choose the one ending with ":war exploded"
  10. Click Apply
  11. If you haven't configured MySQL yet, do it now and take note of the credentials
  12. Create a schema called marketing_application
  13. In IntelliJ navigate to _View > Tool Windows > Database, click '+' and select Data Source > MySQL and fill in with your database connection credentials
  14. In Database field, specify marketing_application and test the connection
  15. Click Apply
  16. In the Database panel, select marketing_application under your database, right click and select Run SQL script...
  17. Select sql-dump/marketing_application.sql and run it
  18. Navigate to the TomEE folder, and open conf/tomee.xml
  19. Between the <tomee>...</tomee> tags, add the following code, replacing SERVER, USERNAME and PASSWORD with the credentials the application will use to connect to the database
  <Resource id="MarketingApplicationDB" type="DataSource">
    JdbcDriver com.mysql.cj.jdbc.Driver
    JdbcUrl jdbc:mysql://SERVER:3306/marketing_application
    UserName USERNAME
    Password PASSWORD
  </Resource>
  1. Download Connector/J, uncompress it and drop mysql-connector-java- in /lib

Test setup

  1. Run the server with Shift + F10 (or click the green play button); if it's not clickable, close and reopen IntelliJ
  2. Once the browser opens, try logging in with username user1 and password user
  3. If the setup was successful, you'll see a welcome page. If you get a 404 error page you probably didn't setup tomee.xml at step 20; if you can't get the server to load, you probably haven't installed TomEE or Connector/J correctly.

About

Reupload of a university project about MySQL Triggers and ORM/JPA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published