I want to get some values from my database, but when I click button void ButtonClick my app crashes. Starting with Java 7, there is no need to use forName method. You are creating a new instance in this way and in the same time you are trying to create a connection using DriverManager.
So in order to solve this, just remove the instantiation of the driver using forName method. Actually you may be able to use JDBC, but it is not recommended. Please see this post. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 4 years, 4 months ago.
If mysql-connector-java Driver at run-time. Remember, there won't be any error during compile time because your program has no direct dependency to this JAR i. When Class. Solution : You can fix this error by deploying mysql-connector-java Depending upon your build tool you can do the following to fix java. Driver in Eclipse, Maven, and Gradle. Fixing java. Driver Solution in Maven Fixing this error in Maven is bit easy, just add following dependency in your project's pom.
Select pom. Go to the dependency tab as shown below. Labels: error and exception , JDBC. Hal Rose April 10, at PM. Unknown June 20, at AM. Unknown November 13, at PM. Unknown January 31, at AM. Unknown May 12, at AM. Unknown May 16, at PM. Unknown March 5, at PM. Unknown June 27, at AM. Unknown September 3, at AM.
Unknown September 9, at PM. Anonymous November 6, at AM. Unknown March 10, at PM. You can use the first tab to connect, and then see the created URL in the second tab. Connectivity Troubleshooting If you get problems connecting to the database, please remember : Press the ping button in the connection dialog to make sure the host and port are reachable.
Enable Remote connections as they are not always enabled by default. This may require configuration changes. Windows Firewall may block the communication. You may need to reconfigure or disable it. Check the driver version is compatible with the database software. Please inform us in this case.
0コメント