package com.ruoyi.predict.utils;

/**
 * @author hlf
 * @date 2022/12/15 9:36
 * 文件说明：
 */
public class SynchronizingDataUtil {

    /*public static void main(String[] args) {
        final String URL = "jdbc:oracle:thin:@120.46.129.85:1521/ORCL";
        final String USER = "gyee";
        final String PWD = "FRWIND";
        try {
            //加载驱动程序
            Class.forName("oracle.jdbc.OracleDriver");
            System.out.println("加载驱动成功！");
        } catch (Exception e) {
            System.out.println("加载驱动异常" + e);
        }
        try { //获得数据库连接
            Connection con = DriverManager.getConnection(URL, USER, PWD);
            System.out.println("加载数据库连接成功！");
            String sql = "select * from noscale_wf_da_pf_period_data";
            PreparedStatement pt = con.prepareStatement(sql);
            ResultSet rs = pt.executeQuery();
            System.out.println(rs.next());
            while (rs.next()) {
                String userid = rs.getString("windplant_no");
                System.out.println(userid);
            }
            rs.close();
            pt.close();
            con.close();
        } catch (SQLException e) {
            System.out.println("加载数据库连接异常" + e);
        }
    }*/

    /*public static void main(String[] args) {
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        try {
            //实例化oracle数据库驱动程序(建立中间件)
            Class.forName("oracle.jdbc.driver.OracleDriver");
            String url = "jdbc:oracle:thin:@120.46.129.85:1521/ORCL";
            conn = DriverManager.getConnection(url, "gyee", "FRWIND");
            //提交sql语句,创建一个Statement对象来将SQL语句发送到数据库
            stmt = conn.createStatement();
            //执行查询
            rs = stmt.executeQuery("select * from WINDPLANT");
            //使当前记录指针定位到记录集的第一条记录
            while (rs.next()) {
                System.out.println(rs.getString("WINDPLANT_NO") + " " + rs.getString("NAME"));
            }
            //查询数据用executeQuery
            //stmt.executeQuery("select * from WINDPLANT");
            //添加数据用executeUpdate
            //stmt.executeUpdate("insert into WINDPLANT(WINDPLANT_NO, NAME) values(10, '测试风场')");
            //修改数据用executeUpdate
            //stmt.executeUpdate("update WINDPLANT set NAME = '测试风场' where WINDPLANT_NO = 5");
            //删除数据用executeUpdate
            //stmt.executeUpdate("delete from WINDPLANT where WINDPLANT_NO = 10");
        } catch (SQLException | ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            try {
                //关闭数据库，结束进程
                rs.close();
                stmt.close();
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }*/
}
