One connection pool per connectionstring
예제 #1
0
        /// <summary>
        /// Get a connection pool. If it doesn't exist yet, create it
        /// </summary>
        /// <param name="connectionSettings"></param>
        /// <returns></returns>
        static public DB2ConnectionPool GetConnectionPool(DB2ConnectionSettings connectionSettings)
        {
            DB2Environment environment = DB2Environment.Instance;

            lock (environment.connectionPools.SyncRoot)
            {
                DB2ConnectionPool pool = (DB2ConnectionPool)environment.connectionPools[connectionSettings.ConnectionString];
                if (pool == null)
                {
                    pool = new DB2ConnectionPool(connectionSettings);
                    environment.connectionPools.Add(connectionSettings.ConnectionString, pool);
                }
                return(pool);
            }
        }
예제 #2
0
        public static DB2ConnectionSettings GetConnectionSettings(string connectionString)
        {
            DB2ConnectionPool pool = DB2ConnectionPool.FindConnectionPool(connectionString);

            if (pool != null)
            {
                return(pool.ConnectionSettings);
            }
            DB2ConnectionSettings settings = new DB2ConnectionSettings(connectionString);

            if (settings.Pooling)
            {
                settings.pool = DB2ConnectionPool.GetConnectionPool(settings);
            }
            return(settings);
        }
예제 #3
0
		/// <summary>
		/// Get a connection pool. If it doesn't exist yet, create it
		/// </summary>
		/// <param name="connectionSettings"></param>
		/// <returns></returns>
		static public DB2ConnectionPool GetConnectionPool(DB2ConnectionSettings connectionSettings)
		{
			DB2Environment environment = DB2Environment.Instance;

			lock(environment.connectionPools.SyncRoot)
			{
				DB2ConnectionPool pool = (DB2ConnectionPool)environment.connectionPools[connectionSettings.ConnectionString];
				if(pool == null)
				{
					pool = new DB2ConnectionPool(connectionSettings);
					environment.connectionPools.Add(connectionSettings.ConnectionString, pool);
				}
				return pool;
			}
		}