This is a repost from Java Programming Forum. I am reposting here because I am concerned over low traffic.
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:
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
Open the ch12email project that's in the book_apps directory.
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.
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.
...
...
I was able to open the project.
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".
Doing so opens the New Connection Wizard.
While looking around for help on Stack Overflow, I ran into this suggestion:
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
which prompted me to check these connection wizard login boxes against the context.xml.
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'.)
Many of the answers I have found seem to suggest either creating a new database or editing an existing database, but as I've not yet built one myself, I wouldn't yet know how to do this.
The above statement is the basis of why I believe the popular solution link here, is not sufficient for me. I'll continue to work at it, but there are too many unknown aspects of what a database is and how it works with everything else to be able to solve it easily. This is getting into the weeds here, but I am now being asked to defend my question. There is a world of difference between an answer like this, and an answer like this. In the first answer, you barely need to know anything. The second gives key information with an unspecified application. Now it seems it is the answers that I have difficulty with and not the question, but I believe / hope the questions of each posting have elicited like answers. Also, the suggested post is a question concerning Eclipse rather than NetBeans, and if that doesn't matter than I wouldn't know that either.