1. Create a new app on Heroku
2. After successful creation, add support for MySQL, click Find more Add-ons
3. I chose Jawsdb Mysql here.
4. We can view the configuration of the database after the successful addition
5. Then connect to the remote database locally via MySQL Workbench and execute the appropriate SQL statement to create the database and table required by the application
6. Then we need to change the settings of the database connection file in the Web project to the corresponding configuration above
7.---Focus, then we introduce the Mysql-connector.jar package required to connect MySQL into the Web-inf file, which must be introduced, if only the local add Mysql-connector.jar package into the reference direct export, on the remote server, running the app attempt to connect to the database, will report class not found error. On the project, right-click to select Propertise.
8. After joining, we right-click on the project and select Export-to-war file, where I export the war to the desktop
9. Next we add the local command line support for Heroku.
Install Heroku by linking Https://devcenter.heroku.com/articles/heroku-cli#download-and-install.
Installing a plug-in to deploy war by Heroku plugins:install heroku-cli-deploy directive
10. We then log in to Heroku.
The instructions to deploy the war file to the server are as follows:
11. Done. We can access our app via the URL in the red box.
Deploying Java Web Projects to Heroku