//1.驱动 Class.forName("com.mysql.jdbc.Driver"); //2.连接 Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/hm", "root", "admin"); //st载体 Statement st = conn.createStatement(); //sql语句 String sql = "select * from test"; //执行并接受返回 ResultSet result = st.executeQuery(sql);