Friday, April 19, 2013

Inserting data into DB2 from CSV file (using Ruby)

I recently had to import some data into DB2 and I came up with this little program to help me out. I had to search the Internet for a few hints and finally came up with this code that was useful to me. I hope that it will help anyone that needs the same thing. I am pretty sure that this can be accomplished even easier, so if you have a suggestion, please let me know.

Before you use this you will need to install appropriate gems.

gem install activerecord
gem install ibm_db

If you are behind the proxy, do not forget to set it: SET HTTP_PROXY=http://user:password@ip-address:port