this problem is in the database connection failure, looked up from the Internet, the solution is varied, there are configuration files, and change the code. But everyone makes the same mistake for different reasons.
will be stupid, suddenly realized that the database can not connect, either url, or a user name or password. Turning back, the real cause was found…
error code:
String url="jdbc:mysql://localhost:3306/jdbcstudy?useUnicode=true&characterEncoding=utf8&useSSL=true";
String username="root";
String password="123456";
remove (with warning) or change to false after url:
String url="jdbc:mysql://localhost:3306/jdbcstudy?useUnicode=true&characterEncoding=utf8&useSSL=false";
String username="root";
String password="123456";
is not an error, you can query out.
p>
Read More:
- Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure (How to Fix)
- When executing hive – f script com.mysql.jdbc . exceptions.jdbc4 .CommunicationsException: Communications link failure
- Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communicat
- solve com.mysql.jdbc . exceptions.jdbc4 .MySQLSyntaxErrorException:
- java.lang.ClassNotFoundException : com.mysql.jdbc . driver project cannot connect to database, exception, lack of MySQL driver
- How to solve the problem of “08001” when JDBC connects to MySQL
- Analysis of JDBC connection to MySQL
- Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdb
- Exception in thread “main“ java.lang.ClassCastException: com.sun.proxy.$Proxy8 cannot be cast to XXX
- java.lang.AbstractMethodError:com.mysql.jdbc.Connection.isValid(I)Z
- Solutions to errors in the final running of JDBC programming
- com.microsoft.sqlserver . jdbc.SQLServerException : invalid object name ‘XX’
- Realize the simplest recursive call, simulate exception in thread “main” java.lang.stackoverflowerror exception
- In the XML configuration file of spring jdbc.properties The connection to the database failed due to garbled code
- [Solved] Mac ES Startup Error: Exception in thread “main“ java.nio.file.NotDirectoryException
- Resolve the exception MySQL lontransientconnectionexception: communications link failure during rollback()
- Encapsulation of adding, deleting and modifying database by JDBC
- com.mysql.cj.exceptions.NumberOutrange
- How to Fix com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
- How to Fix The error may exist in com/kuang/dao/UserMapper.xml