To learn about databases, I am working through this Murach book published in 2014. I am using NetBeans 8.2, Tomcat 8.0, and I have two MySQL Servers installed, version 5.5 and version 8.0. I also have MySQL Workbench 8.0 CE installed and a Tomcat 9.0. I have gotten pre-built web applications to work with a Tomcat server. The exercise I am working on is the final test run to make sure that all the software I need is correctly installed and configured. At this point all I really know is Java. I don't know anything about databases yet. I've only blindly followed installation instructions. This is the last thing I need to get working before I start learning stuff.
From the book:
I was able to open the project.Exercise 3-3: Run web applications that use a database
This exercise has you run two of the web applications presented in this book that use a database. This forces you to register the connections for the two databases that are used by this book. For this to work, you must install and configure the MySQL database server as described in appendix A (PC) or B (Mac).
Use the Murach database
1. Open the ch12email project that's in the book_apps directory.
2. If that displays a dialog box that says the database connection needs to be registered with NetBeans, click on the Close button for this dialog box. Then right-click on the project, select the Resolve Data Sources Problem item, and use the resulting dialog boxes to resolve the data source problem and register the database connection for the murach database.
3. Run the application to see how it works. After you enter your name and email address and click on the Join Now button, your entries are saved to a MySQL database.
4. ...
5. ...
project01.jpg
I did not get a database connection dialog box warning, but if I right click on the project, I can select Resolve Data Sources. A dialog box opens which allows me to "Add Connection".
resolveDataSources.JPG
Doing so opens the New Connection Wizard.
new connection wizard 01.JPG
While looking around for help on Stack Overflow, I ran into this suggestion:
which prompted me to check these connection wizard login boxes against the context.xml.check the context.xml file in Web Pages -> META-INF, the username="user" must be the same as the database user, in my case was root, that solved the connection error
My context.xml:
<Resource name="jdbc/murach" auth="Container" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/murach" username="murach_user" password="sesame" maxActive="100" maxIdle="30" maxWait="10000" logAbandoned="true" removeAbandoned="true" removeAbandonedTimeout="60" type="javax.sql.DataSource" />
This information seems to match, but when I click on "Test Connection", I get this error:
Cannot establish a connection to jdbc:mysql://localhost:3306/murach using com.mysql.jdbc.Driver (Unable to load authentication plugin 'caching_sha2_password'.)