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
Table of contents 1. Environmental Preparation 1....
Description of the situation: Today, I logged int...
Many organizations have the need to back up file ...
Table of contents Preface Option 1: Option 2: Opt...
This article example shares the specific code for...
Preface In front-end programming, we often use th...
Table of contents 1. Routing Configuration 2. Vue...
Based on theories such as Saussure's philosop...
Anaconda is the most popular python data science ...
Preface This chapter uses basic Linux functions a...
Table of contents Effects Documentation first ste...
By default, setting width for label and span is in...
Preface Nodejs is a server-side language. During ...
1. System environment The system version after yu...
1. Download Navicat for MySQL 15 https://www.navi...