Method: Sequel::IBMDB::Database#connect

Defined in:
lib/sequel/adapters/ibmdb.rb

#connect(server) ⇒ Object

Create a new connection object for the given server.



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/sequel/adapters/ibmdb.rb', line 189

def connect(server)
  opts = server_opts(server)

  connection_params = if opts[:host].nil? && opts[:port].nil? && opts[:database]
    # use a cataloged connection
    opts.values_at(:database, :user, :password)
  else
    # use uncataloged connection so that host and port can be supported
    'Driver={IBM DB2 ODBC DRIVER};' \
    "Database=#{opts[:database]};" \
    "Hostname=#{opts[:host]};" \
    "Port=#{opts[:port] || 50000};" \
    'Protocol=TCPIP;' \
    "Uid=#{opts[:user]};" \
    "Pwd=#{opts[:password]};" \
  end 

  Connection.new(connection_params)
end