    # File SQLRelay.rb, line 51
      def connect(dbname, user, auth, attr)

        # connect to database

        # dbname will have one of these formats:
        # dbi:SQLRelay:host:port
        # dbi:SQLRelay:host=xxx;port=xxx;socket=xxx;retrytime=xxx;tries=xxx
        hash = Utils.parse_params(dbname)

        if hash.has_key? "database" then
          # handle the first form
          hash["host"], hash["port"] = hash["database"], hash["host"]
        end

        # set default values if none were supplied
        hash['host']      ||= "localhost"
        hash['port']      ||= "9000"
        hash['socket']    ||= ""
        hash['retrytime'] ||= "0"
        hash['tries']     ||= "1"

        # TODO: what happens on connection failure? return nil?
        handle = SQLRConnection.new(hash['host'], hash['port'].to_i,
          hash['socket'], user, auth, hash['retrytime'].to_i, hash['tries'].to_i)

        return Database.new(handle, attr)
      end