package com.th.demo.tools.generator;

import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class GetConnection {
    public static Connection getConnection (String path){
        Connection  conn = null;
        try {
//            String Class_Name = "org.sqlite.JDBC";
//            String DB_URL = "jdbc:sqlite:"+path+"th.db";
//
//            Class.forName(Class_Name);
//            conn = DriverManager.getConnection(DB_URL);


            String Class_Name = "com.mysql.jdbc.Driver";
            String url = "jdbc:mysql://118.24.251.157:3306/thware?characterEncoding=utf8";
            String user = "thware";
            String password = "thware";
            Class.forName(Class_Name);
            conn = DriverManager.getConnection(url, user, password);

//		Class.forName("oracle.jdbc.driver.OracleDriver");
//		String url = "jdbc:oracle:thin:@172.16.7.190:1521:devdb";
//		String user = "syb01";
//		String password = "xxhsyb";
//		conn = DriverManager.getConnection(url, user, password);




//		Class.forName("oracle.jdbc.driver.OracleDriver");
//		String url = "jdbc:oracle:thin:@172.16.69.145:1521:rcmes";
//		String user = "rcmes";
//		String password = "rcmes";


//		Class.forName("oracle.jdbc.driver.OracleDriver");
//		String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.4.21)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.4.23)(PORT=1521))(LOAD_BALANCE =yes)(ENABLE=broken)(CONNECT_DATA=(SERVICE_NAME=fmesdb)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=80)(DELAY=5))))";
//		String user = "jisco";
//		String password = "asdf987";


//		Class.forName("com.mysql.jdbc.Driver");
//		String url = "jdbc:mysql://172.16.69.49:3306/pa";
//		String user = "pa";
//		String password = "pa";


        } catch (ClassNotFoundException e) {




		e.printStackTrace();
	} catch (SQLException e) {
		
		e.printStackTrace();
	}
	return conn;
}



    public static Connection getConnection (){
        Connection  conn = null;
        try {

//		Class.forName("oracle.jdbc.driver.OracleDriver");
//		String url = "jdbc:oracle:thin:@172.16.7.190:1521:devdb";
//		String user = "syb01";
//		String password = "xxhsyb";
//		conn = DriverManager.getConnection(url, user, password);

            String Class_Name = "com.mysql.jdbc.Driver";
            String url = "jdbc:mysql://118.24.251.157:3306/thware?characterEncoding=utf8";
            String user = "thware";
            String password = "thware";
            Class.forName(Class_Name);
            conn = DriverManager.getConnection(url, user, password);



//		Class.forName("oracle.jdbc.driver.OracleDriver");
//		String url = "jdbc:oracle:thin:@172.16.69.145:1521:rcmes";
//		String user = "rcmes";
//		String password = "rcmes";


//		Class.forName("oracle.jdbc.driver.OracleDriver");
//		String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.4.21)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.4.23)(PORT=1521))(LOAD_BALANCE =yes)(ENABLE=broken)(CONNECT_DATA=(SERVICE_NAME=fmesdb)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=80)(DELAY=5))))";
//		String user = "jisco";
//		String password = "asdf987";


//		Class.forName("com.mysql.jdbc.Driver");
//		String url = "jdbc:mysql://172.16.69.49:3306/pa";
//		String user = "pa";
//		String password = "pa";


        } catch (ClassNotFoundException e) {




            e.printStackTrace();
        } catch (SQLException e) {

            e.printStackTrace();
        }
        return conn;
    }


}
