package com.template.controller;
import lombok.extern.log4j.Log4j2;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
 * @Author：liuxinyue
 * @Package：com.template.controller
 * @Project：cloud-server
 * @name：ServiceController
 * @Date：2024/9/22 22:12
 */
@Log4j2
public class ServiceController {

    private final String IOTDB_DRIVER="org.apache.iotdb.jdbc.IoTDBDriver";
    private static final String url="jdbc:iotdb://47.116.173.119:6667/";
    private static final String userName="root";
    private static final String passWord="root";

  public void ToIoTDB(String url, String userName, String passWord){
   log.info("Connecting to IoTDB");
   log.info("地址是:"+url);
   log.info("用户名是:"+userName);
   log.info("密码是:"+passWord);
   log.info("红红火火恍恍惚惚");
  }

    public static void main(String[] args) {
        try{
            Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
            DriverManager.getConnection(url,userName,passWord);
        }catch(SQLException e){
            log.error("SQLException: " + e.getMessage());
            log.error("SQLState: " + e.getSQLState());
            log.error("VendorError: " + e.getErrorCode());
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

  private void createConnection() throws ClassNotFoundException, SQLException {

      try{
          Class.forName(IOTDB_DRIVER);
          DriverManager.getConnection(url,userName,passWord);
      }catch(SQLException e){
          log.error("SQLException: " + e.getMessage());
          log.error("SQLState: " + e.getSQLState());
          log.error("VendorError: " + e.getErrorCode());
      }


  }

}
