简体   繁体   English

IBM Bluemix上的DB2

[英]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. 我只是从Bluemix开始,我创建了一个小型Rails 4应用程序,并使用sqlite在本地对其进行了测试。 As DB2 is the default on Bluemix I opted for it when I setup the app. 因为DB2是Bluemix上的缺省数据库,所以我在设置应用程序时选择了它。

When I added the ibm_db gem to my gem file ready to deploy to Bluemix I got the following error from bundler: 当我将ibm_db gem添加到准备部署到Bluemix的gem文件中时,我从捆绑程序中收到以下错误:

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. 我没有在开发机器上安装DB2,因为我不会将其用于其他任何东西,我通常使用Postgres,但这在Bluemix上本身不受支持,这是我不想进入的第三方提供程序。 I'm not willing to install DB2 just to deploy to Bluemix, I'm hoping theres another way ? 我不愿意仅仅为了部署到Bluemix而安装DB2,我希望有另一种方法吗?

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. 为了从本地计算机连接到DB2,还需要安装IBM DB2驱动程序,并将IBM_DB_HOME环境变量设置为安装驱动程序包的路径。 (eg /home/db2inst1/sqllib) (例如,/ 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. 然后,ibm_db gem应该能够找到必要的二进制文件以建立与数据库的连接。

You can obtain a driver here: https://www-304.ibm.com/support/docview.wss?uid=swg21418043 您可以在这里获取驱动程序: 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 Express-C在本地进行测试,所以本文也对您有所帮助: http : //www.ibm.com/developerworks/data/library/techarticle/dm-0705chun/

DB2 is not default on Bluemix. DB2在Bluemix上不是默认的。 You can select a range of database services offered on bluemix and you need to bind your app with that database service. 您可以选择bluemix上提供的一系列数据库服务,并且需要将您的应用程序与该数据库服务绑定。 For DB2, you can opt for a SQLDB service. 对于DB2,您可以选择SQLDB服务。 On Bluemix, DB2 comes as SQLDB. 在Bluemix上,DB2是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. 如果在部署针对DB2的应用程序客户端驱动程序时丢失了在Bluemix中推送应用程序,则会出现“未设置环境变量IBM_DB_HOME”错误。 Bluemix automatically download DB2 client driver if version of your gem is 2.5.18 or later. 如果您的gem版本是2.5.18或更高版本,那么Bluemix会自动下载DB2客户机驱动程序。 It seems you are using older version of gem. 看来您使用的是旧版的gem。 Hence, getting this error. 因此,得到此错误。 Download latest version of gem and try. 下载最新版本的gem并尝试。 It should work. 它应该工作。

you can choose from wide range of DB(mysql,SQLDB,mongodb,elephantSQL) service offerings from Bluemix dashoard. 您可以从Bluemix dashoard的各种DB(mysql,SQLDB,mongodb,elephantSQL)服务产品中进行选择。 There is no such default db or any services is defined in Bluemix!! 没有这样的缺省数据库,或者在Bluemix中定义了任何服务!

I think you are likely on Mac and Darwin 14 more specifically for which there isn't yet a prebuilt ibm_db binary. 我认为您可能更特别地在Mac和Darwin 14上使用,但还没有预构建的ibm_db二进制文件。 U can follow on this dw thread for updates 您可以在 dw线程上进行更新

DB2 is termed as SQLDB in bluemix dashboard,which is not the default one.Infact,Bluemix dont have anything boilerplate which is default. DB2在bluemix仪表板中被称为SQLDB,这不是默认的。事实上,Bluemix没有任何默认的样板。

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. 现在查看错误代码片段,您提供的“未设置环境变量IBM_DB_HOME”意味着缺少用于DB2的应用程序客户端驱动程序。

Possible reason would be that you are using older version gem,you should try to download latest version,which would fix this error. 可能的原因是您使用的是旧版gem,请尝试下载最新版本,这将修复此错误。

Hope it helps!!! 希望能帮助到你!!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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