Today, for a connection to the database to get information to use for the ListView, for a full 5 hours.
Some of the problems that arise are:
The first is, drivermanager.getconnection (URL, user, pwd), the code executed before this function is successful, it is not executed, and there is no error.
It means that this line of code does not work, adding a lot of anomaly testing and capturing is a kind of. Online methods have also tried a lot. And then I found out that the wrong place was mine.
The URL was incorrectly written.
Because I want to connect to the MySQL database of the machine, and I enter in the browser is to add after localhost: 8080, that is localhost:8080
So I wrote in the code to write the URL as a String url = "Jdbc:mysql://localhost:8080/mysql"; Cause an error.
The correct wording should be the port to write the database, 3306, is to change 8080 to 3306.
The second question is:
After the first problem is resolved, the compilation has a new problem, Error:java.sql.SQLException:Access denied for user ' xxxx ' @ ' localhost ' (using Password:yes)
This error was thrown, the method of the Internet a lot of, anything, and then subconsciously in my MySQL built a new user, the code was originally set up the connection user account changed, the password has changed
Reconnect, I'm done. Specifically what causes no further research.
Solutions to several problems with Java connection to MySQL database.