简体   繁体   中英

DB2 on IBM Bluemix

I'm just starting out on Bluemix, I've created a small rails 4 app and tested it locally using sqlite. As DB2 is the default on Bluemix I opted for it when I setup the app.

When I added the ibm_db gem to my gem file ready to deploy to Bluemix I got the following error from bundler:

Environment variable IBM_DB_HOME is not set. Set it to your DB2/IBM_Data_Server_Driver installation directory and retry gem install.

I don't have DB2 installed on my dev machine as I won't use it for anything else, I normally use Postgres but thats not natively supported on Bluemix it's a third party provider which I don't want to get into. I'm not willing to install DB2 just to deploy to Bluemix, I'm hoping theres another way ?

Thanks.

In order to make a connection to DB2 from your local machine, you'll also need an IBM DB2 driver installed and your IBM_DB_HOME environment variable set to the path where you install the driver package. (eg /home/db2inst1/sqllib)

The ibm_db gem should then be able to find the necessary binaries in order to make a connection to the database.

You can obtain a driver here: https://www-304.ibm.com/support/docview.wss?uid=swg21418043

This developerworks article will also be of help, as you could use DB2 Express-C to test things out locally: http://www.ibm.com/developerworks/data/library/techarticle/dm-0705chun/

DB2 is not default on Bluemix. You can select a range of database services offered on bluemix and you need to bind your app with that database service. For DB2, you can opt for a SQLDB service. On Bluemix, DB2 comes as SQLDB.

We get "Environment variable IBM_DB_HOME is not set" error while pushing app in Bluemix if during deployment of your app client driver for DB2 is missing. Bluemix automatically download DB2 client driver if version of your gem is 2.5.18 or later. It seems you are using older version of gem. Hence, getting this error. Download latest version of gem and try. It should work.

you can choose from wide range of DB(mysql,SQLDB,mongodb,elephantSQL) service offerings from Bluemix dashoard. There is no such default db or any services is defined in Bluemix!!

I think you are likely on Mac and Darwin 14 more specifically for which there isn't yet a prebuilt ibm_db binary. U can follow on this dw thread for updates

DB2 is termed as SQLDB in bluemix dashboard,which is not the default one.Infact,Bluemix dont have anything boilerplate which is default.

Now looking at the error snippet your provided "Environment variable IBM_DB_HOME is not set" means that your app client driver for DB2 is missing.

Possible reason would be that you are using older version gem,you should try to download latest version,which would fix this error.

Hope it helps!!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM