用jdbc技术实现连接mysql数据库。
SQL/Test1.java
package cn.antraces.SQL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Test1 {
public static void main (String[] args) throws ClassNotFoundException, SQLException {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection = DriverManager.getConnection(
"jdbc:mysql://127.0.0.1:3306/mysql?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT", "root", "wodiu");
System.out.println(connection);
}
}