package com.xiaomai.utils;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;


public class JDBCConnect {

    public  void testjdbc(){
        JdbcTemplate template = JDBCConnect.getTemplate();
        List userInfoList = template.queryForList("select * from `api_info`");

        System.out.println(userInfoList);
    }

    public static JdbcTemplate getTemplate(){
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:mysql://120.27.248.253:3306/xm_sports");
        dataSource.setName("TestGetAdmin");
        dataSource.setUsername("root");
        dataSource.setPassword("root");
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        return new JdbcTemplate(dataSource);
    }


}
