// 数据库连接信息 private static String url = "jdbc:mysql://localhost/talent_management_system"; private static String username = "root"; private static String password = "password"; private static Connection conn = null; public static void main(String[] args) { // 连接到数据库 try { conn = DriverManager.getConnection(url, username, password); System.out.println("成功连接到数据库"); } catch (SQLException e) { System.out.println("无法连接到数据库:" + e.getMessage()); return; }
标签:String,某段,截取,private,连接,static,password,数据库 From: https://www.cnblogs.com/w10225/p/17426544.html