Skip to content

Instantly share code, notes, and snippets.

@zambon
Created October 8, 2013 15:59
Show Gist options
  • Save zambon/6886984 to your computer and use it in GitHub Desktop.
Save zambon/6886984 to your computer and use it in GitHub Desktop.
How to connect to a DB2 database using the Ruby gem ibm_db
require 'ibm_db'
database = ''
host = ''
port = ''
username = ''
password = ''
conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=#{database};HOSTNAME=#{host};PORT=#{port};PROTOCOL=TCPIP;UID=#{username};PWD=#{password};"
IBM_DB.connect(conn_string, '', '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment