jdbc

导入mysql驱动包
compile "mysql:mysql-connector-java:5.1.35"
1.获取链接
Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/jqb?useUnicode=true&characterEncoding=utf8&serverTimezone=CTT", "root", "AD0!");
PreparedStatement statement = connection.prepareStatement(" SELECT * from 表名 ");
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()){
    
}

你可能感兴趣的:(java)