protected function connect( $name ) 
	{
		if ( $this->_connected ) 
		{
			return true; 
		}
		
		// check if the name is an array. This way we can
		// pass the configuration directly. We need this 
		// to create for example an handler without having
		// the configuration in the database conf file.
		if ( is_array( $name ) )
		{
			$config = $name;
		}
		else 
		{
			$config = \CCConfig::create( 'database' )->get( $name );
			
			// check for an alias. If you set a string 
			// in your config file we use the config 
			// with the passed key.
			if ( is_string( $config ) ) 
			{
				$config = \CCConfig::create( 'database' )->get( $config );
			}
		}

		// Setup the driver class. We simply use name 
		// from the confif file and make the first letter 
		// capital. example: Handler_Mysql, Handler_Sqlite etc.
		$driver_class = __NAMESPACE__."\\Handler_".ucfirst( $config['driver'] );
		
		if ( !class_exists( $driver_class ) )
		{
			throw new Exception( "DB\\Handler::connect - The driver (".$driver_class.") is invalid." );
		}
		
		$this->set_driver( $driver_class );
		
		// setup the builder the same way as the handler.
		$driver_class = __NAMESPACE__."\\Builder_".ucfirst( $config['driver'] );
		
		if ( !class_exists( $driver_class ) )
		{
			throw new Exception( "DB\\Handler::connect - The builder (".$driver_class.") is invalid." );
		}
		
		$this->set_builder( $driver_class );
		
		// finally try to connect the driver with the databse
		if ( $this->driver()->connect( $config ) ) 
		{
			return $this->_connected = true;
		}

		return $this->_connected = false;
	}