连接数据库
public class jdbctest {
public static void main(String[] args) throws Exception{
String url="jdbc:mysql://localhost:3306/da?useUnicode=true&characterEncoding=utf8";
String user="root";
String password="";
Connection conn=null;
Statement st=null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection = DriverManager.getConnection(url,user,password);
} catch (Exception e) {
e.printStackTrace();
}finally{
conn.close();
}
}
}