Example #1
0
 //public static IConnectionObject createMSSQLConnection()
 //{
 //    return
 //}
 internal static IConnectionObject createConnection(string provider, string server, string initDB, bool trusted, string username, string password, string port, string sid)
 {
     dbFactory = System.Data.Common.DbProviderFactories.GetFactory(providers[provider]);
     if (provider.Equals("Oracle"))
     {
         return(OracleConn.GetInstance(server, port, sid, username, password, dbFactory));
     }
     if (provider.Equals("MSSQL"))
     {
         return(DBConn.GetInstance(server, initDB, trusted, username, password, dbFactory));
     }
     throw new NotImplementedException();
 }
Example #2
0
        public static OracleConn GetInstance(string server, string port, string SID, string username, string password, DbProviderFactory provider)
        {
            if (instance == null)
            {
                instance = new OracleConn();
            }
//            _dbFactory = provider;

            try
            {
                connStringBuilder = new ConnectionStringBuilderOracle(server, "", username, password, port, SID, null);
                conn = GetConnection();
            }
            catch (ArgumentException e)
            {
                MessageBox.Show("Connection String Error! (" + e.Message + ")");
            }
            catch (InvalidOperationException e)
            {
                MessageBox.Show("Invalid Operation Error! (" + e.Message + ")");
            }

            return(instance);
        }