Beispiel #1
0
        public static OracleConnection GetDBConnection(DataOracle oracle)
        {
            Console.WriteLine("Getting Connection ...");
            string connectionString = "Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = " + oracle.host + ")(PORT = " + oracle.port + "))(CONNECT_DATA = (SID = " + oracle.sid + ")));Persist Security Info=true;User ID=" + oracle.user + "; Password="******";";

            conn = new OracleConnection();
            conn.ConnectionString = connectionString;
            return(conn);
        }
Beispiel #2
0
        public DataOracle ReadConfigDataBase()
        {
            using (StreamReader streamReader = new StreamReader("ConfigConnect"))
            {
                oracle = new DataOracle();
                string text;
                while ((text = streamReader.ReadLine()) != null)
                {
                    if (text.Contains("="))
                    {
                        string text2 = text.Substring(0, text.IndexOf("="));
                        switch (text2.ToLower())
                        {
                        case "host":
                            oracle.host = getField(text);
                            break;

                        case "port":
                            oracle.port = getField(text);
                            break;

                        case "sid":
                            oracle.sid = getField(text);
                            break;

                        case "user":
                            oracle.user = getField(text);
                            break;

                        case "password":
                            oracle.password = getField(text);
                            break;
                        }
                    }
                }
            }
            return(oracle);
        }