51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

Java学习之路-SQL-用jdbc连接MySql

用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); } }


参考:
https://blog.csdn.net/Yuz_99/article/details/90201265
https://blog.csdn.net/hwt1070359898/article/details/90517291
https://repo1.maven.org/maven2/mysql/mysql-connector-java

赞(1)
未经允许不得转载:工具盒子 » Java学习之路-SQL-用jdbc连接MySql