企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
```java package com.gosuncn; import java.sql.Connection; import java.sql.Driver; import java.util.Properties; public class ConnectionMain { public static void main(String[] args) throws Exception { Class clazz = Class.forName("com.mysql.jdbc.Driver"); Driver driver = (Driver) clazz.newInstance(); String url = "jdbc:mysql://127.0.0.1:3306/test"; Properties info = new Properties(); info.setProperty("user", "root"); info.setProperty("password", "root"); Connection connect = driver.connect(url, info); System.out.println(connect); } } ```