This article mainly introduces the solution to the problem of Failed when configuring IDEA to connect to MYSQL database, and shares it with you. The details are as follows: The error location is as follows We changed it and found that we could connect normally IDEA failed when trying to connect to MySQL When I try to connect to Mysql with IDEA, it always shows that the connection failed, and I only know that the connection object cannot be created. Most of the solutions on the Internet are to modify the connection characters, but in the end I found that it was not a problem with the connection string settings. Moreover, this error is easy to encounter for novices like me, so I share it here. = = Mysql version: Mysql 5.7 Connection jar package: mysql-connector-java-5.1.40-bin.jar The code is as follows: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class Example11_1 { public static void main(String args[]) { Connection con = null; Statement sql; ResultSet rs; try { Class.forName("com.mysql.jdbc.Driver"); //Load JDBC_MySQL driver} catch (Exception e) { } String uri = "jdbc:mysql://localhost:3306/jdbc?useSSL=true"; String user = "root"; String password = "********"; try { con = DriverManager.getConnection(uri, user, password); //Connection code} catch (Exception e) { } try { sql = con.createStatement(); rs = sql.executeQuery("SELECT * FROM mess"); //Query the mess table} catch (Exception e) { System.out.println(e); }finally { //con.close(); } } } The reason was that the path of the Java project I created contained Chinese characters. Later, I tried to create a new project in the root directory and then connected it. //I'm so stupid. This is the end of this article about how to solve the problem of Failed when configuring IDEA to connect to MYSQL database. For more relevant content about configuring IDEA to connect to MYSQL, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Html easily implements rounded rectangle
>>: Nginx builds rtmp live server implementation code
1. Import the basic style of external CSS files U...
CSS: Copy code The code is as follows: *{margin:0;...
Table of contents Mixins implementation Hook func...
1. Meaning of partition table A partition table d...
When using docker images, images with both REPOSI...
MariaDB database management system is a branch of...
Docker Compose can realize the orchestration of D...
VMware tools provides great convenience for using...
How to install iso files under Linux system? Inst...
It is mainly the configuration jump of the if jud...
This article aims to use the clearest structure t...
Event response refresh: refresh only when request...
When installing packages on an Ubuntu server, you...
This article shares the specific code of JavaScri...
When it comes to tool-type websites, we first hav...