{"id":9205,"date":"2016-03-22T14:24:06","date_gmt":"2016-03-22T11:24:06","guid":{"rendered":"http:\/\/blog.altoros.com\/?p=9205"},"modified":"2019-06-20T02:58:05","modified_gmt":"2019-06-19T23:58:05","slug":"accessing-an-external-database-storage-from-a-bluemix-based-ruby-application","status":"publish","type":"post","link":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/","title":{"rendered":"Accessing an External Database Storage from a Bluemix-Based Ruby App"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-accessing-cleardb-mysql-db.png\" alt=\"ibm-bluemix-accessing-cleardb-mysql-db\" width=\"100\" style=\"margin: 0px 0px 0px 15px;\" class=\"alignright size-full wp-image-9219\" \/><\/p>\n<p>In this article, we add a ClearDB connection to a sample Sinatra application running on Bluemix, addressing a very common need to read and save data dynamically.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#Adding_the_ClearDB_service\" >Adding the ClearDB service<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#Obtaining_and_using_database_credentials\" >Obtaining and using database credentials<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#Related_reading\" >Related reading<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Adding_the_ClearDB_service\"><\/span>Adding the ClearDB service<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>First, let\u2019s go to the <a href=\"https:\/\/cloud.ibm.com\/catalog\" target=\"_blank\" rel=\"noopener noreferrer\">Bluemix services catalog<\/a>. In the Data and Analytics section, several storage facilities are available both from IBM and third  parties.<\/p>\n<p>Some of the storage options are well-known RDBMS like PostgreSQL, MySQL, and DB2. There are NoSQL options as well, including Redis, MongoDB, and Cloudant (compatible with CouchDB).<\/p>\n<p>I use the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">megatux-cf-sinatra-db<\/code> application and select a third-party data service that supports MySQL\u2014ClearDB.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-data-and-analytics-cleardb.png\" alt=\"ibm-bluemix-data-and-analytics-cleardb\" width=\"640\" height=\"360\" class=\"aligncenter size-full wp-image-9213\" \/><\/center><\/p>\n<p>Then, I assign the service to the application.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-catalog-cleardb-mysql-db-v1.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-catalog-cleardb-mysql-db-v1.png\" alt=\"ibm-bluemix-catalog-cleardb-mysql-db-v1\" width=\"640\" class=\"aligncenter size-full wp-image-9214\" \/><\/a><\/center><\/p>\n<p>The <a href=\"https:\/\/cloud.ibm.com\/catalog\/services\/cleardb-mysql-database\/\" target=\"_blank\" rel=\"noopener noreferrer\">free plan<\/a> is very limited, but it is enough for our demonstration purposes.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-adding-cleardb-service-v1.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-adding-cleardb-service-v1.png\" alt=\"ibm-bluemix-adding-cleardb-service-v1\" width=\"640\" class=\"aligncenter size-full wp-image-9215\" \/><\/a><\/center><\/p>\n<p>If you run  the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cf services<\/code> command, you will see the list of the application services similar to this:<\/p>\n<pre style=\"padding-left: 30px;\"><code>$ cf services\r\nGetting services in org some_email@mail.com \/ space dev as some_email@mail.com...\r\nOK\r\n\r\nname      service   plan    bound apps              last operation   \r\np-mysql   cleardb   spark   megatux-cf-sinatra-db   create succeeded<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Obtaining_and_using_database_credentials\"><\/span>Obtaining and using database credentials<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Now, we need to obtain the database connection settings for using the service in the application. Cloud Foundry shares this information through the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">VCAP-SERVICES<\/code> environment variable.<\/p>\n<p><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">VCAP-SERVICES<\/code> is in the JSON format and contains all information about the services that the application is associated with.<\/p>\n<p>Find more information at <a href=\"https:\/\/cloud.ibm.com\/docs\/cli\/vcapsvc.html\" target=\"_blank\" rel=\"noopener noreferrer\">IBM Bluemix docs<\/a> and the <a href=\"https:\/\/cloud.ibm.com\/docs\/services\/SQLDB\/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">SQL Database tutorial<\/a>.<\/p>\n<p>You can see these values in your Bluemix application console.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-environment-variables-v1.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-environment-variables-v1.png\" alt=\"ibm-bluemix-environment-variables-v1\" width=\"640\" class=\"aligncenter size-full wp-image-9216\" \/><\/a><\/center><\/p>\n<p>Alternatively, you can use the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cf env<\/code> command:<\/p>\n<pre style=\"padding-left: 30px;\"><code>$ cf env megatux-cf-sinatra-db<\/code><\/pre>\n<p>As you can see in the JSON example, there is the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cleardb<\/code> array that contains the object with the credentials we need:<\/p>\n<pre style=\"padding-left: 30px;\"><code>{\r\n   \"cleardb\": [\r\n      {\r\n         \"name\": \"p-mysql\",\r\n         \"label\": \"cleardb\",\r\n         \"plan\": \"spark\",\r\n         \"credentials\": {\r\n            \"jdbcUrl\": \"jdbc:mysql:\/\/us-cdbr-iron-east-03.cleardb.net\/***********?user=******&amp;password=******\",\r\n            \"uri\": \"mysql:\/\/b90c6d72f4800e:3bab786d@us-cdbr-iron-east-03.cleardb.net:3306\/a******?reconnect=true\",\r\n            \"name\": \"ad***********\",\r\n            \"hostname\": \"us-cdbr-iron-east-03.cleardb.net\",\r\n            \"port\": \"3306\",\r\n            \"username\": \"*********\",\r\n            \"password\": \"********\"\r\n         }\r\n      }\r\n   ]\r\n}<\/code><\/pre>\n<p>We can fetch these values in Ruby and use them for accessing the database:<\/p>\n<p><center><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-cleardb-in-ruby-app-v1.png\" alt=\"ibm-bluemix-cleardb-in-ruby-app-v1\" width=\"640\" class=\"aligncenter size-full wp-image-9217\" \/><\/center><\/p>\n<p>It is simple code with no error checking intended for the first steps with the database service. A sample application with similar code is available on <a href=\"https:\/\/github.com\/megatux\/cf-example-sinatra\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub<\/a>, in the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">bluemix-cleardb<\/code> branch. You can clone it and push to your Bluemix:<\/p>\n<pre style=\"padding-left: 30px;\"><code>$ cf push megatux-cf-sinatra-db<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>With its marketplace of very compelling options, Bluemix gives users the flexibility in choosing a database service as well as relieves them from maintaining this infrastructure. In addition, you have well-documented open standards and tools like OpenStack and Cloud Foundry.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Related_reading\"><\/span>Related reading<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/getting-started-with-ibm-bluemix-deploying-a-sample-ruby-sinatra-app\/\">Getting Started with IBM Bluemix: Deploying a Sample Ruby\/Sinatra App<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/continuous-integration-and-continuous-delivery-in-ibm-bluemix\/\">Continuous Integration and Continuous Delivery in IBM Bluemix<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/the-ibm-bluemix-object-storage-service-in-ruby-projects\/\">Using IBM Bluemix Object Storage in Ruby Projects<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/deploying-a-rails-app-with-elasticsearch-to-ibm-bluemix\/\">Deploying a Rails App with Elasticsearch to IBM Bluemix<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/demo-building-java-apps-with-bluemix-and-db2\/\">Building Java Apps with IBM Bluemix and DB2<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/how-to-connect-to-xpages-nosql-db-from-the-node-js-runtime-in-bluemix\/\">How to Connect to XPages NoSQL DB from the Node.js Runtime in Bluemix<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<\/p>\n<p>In this article, we add a ClearDB connection to a sample Sinatra application running on Bluemix, addressing a very common need to read and save data dynamically.<\/p>\n<p>&nbsp;<\/p>\n<p>Adding the ClearDB service<\/p>\n<p>First, let\u2019s go to the Bluemix services catalog. In the Data and Analytics section, several storage facilities are available both from [&#8230;]<\/p>\n","protected":false},"author":54,"featured_media":44437,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[214],"tags":[873,187],"class_list":["post-9205","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-cloud-native","tag-ibm-bluemix"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Accessing an External Database Storage from a Bluemix-Based Ruby App | Altoros<\/title>\n<meta name=\"description\" content=\"One of the many benefits that a PaaS provides is how easily you can extend its functionality with external services.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Accessing an External Database Storage from a Bluemix-Based Ruby App | Altoros\" \/>\n<meta property=\"og:description\" content=\"In this article, we add a ClearDB connection to a sample Sinatra application running on Bluemix, addressing a very common need to read and save data dynamically. &nbsp; Adding the ClearDB service First, let\u2019s go to the Bluemix services catalog. In the Data and Analytics section, several storage facilities are available both from [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/\" \/>\n<meta property=\"og:site_name\" content=\"Altoros\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-22T11:24:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-06-19T23:58:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-data-and-analytics-cleardb-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"693\" \/>\n\t<meta property=\"og:image:height\" content=\"399\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Cristian Molina\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Cristian Molina\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/\"},\"author\":{\"name\":\"Cristian Molina\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/c80777ff65c90ca4979b46cc79d1310b\"},\"headline\":\"Accessing an External Database Storage from a Bluemix-Based Ruby App\",\"datePublished\":\"2016-03-22T11:24:06+00:00\",\"dateModified\":\"2019-06-19T23:58:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/\"},\"wordCount\":402,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/ibm-bluemix-data-and-analytics-cleardb-1.png\",\"keywords\":[\"Cloud-Native\",\"IBM Bluemix\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/\",\"name\":\"Accessing an External Database Storage from a Bluemix-Based Ruby App | Altoros\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/ibm-bluemix-data-and-analytics-cleardb-1.png\",\"datePublished\":\"2016-03-22T11:24:06+00:00\",\"dateModified\":\"2019-06-19T23:58:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/c80777ff65c90ca4979b46cc79d1310b\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/ibm-bluemix-data-and-analytics-cleardb-1.png\",\"contentUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/ibm-bluemix-data-and-analytics-cleardb-1.png\",\"width\":693,\"height\":399},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Accessing an External Database Storage from a Bluemix-Based Ruby App\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/\",\"name\":\"Altoros\",\"description\":\"Insight\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/c80777ff65c90ca4979b46cc79d1310b\",\"name\":\"Cristian Molina\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/Molina_Cristian-140x140.jpg\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/Molina_Cristian-140x140.jpg\",\"contentUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/Molina_Cristian-140x140.jpg\",\"caption\":\"Cristian Molina\"},\"description\":\"Cristian Molina wanted to be a programmer since he saw the first games on Atari 2600. Later, he started hacking with Basic, then C and Java. In the 2000s, he worked mostly with Java, developing web applications at companies in a wide range of industries: from media and communications to transportation, banking, and finance. After making the switch to full-time Ruby development in 2010, he's enjoying learning everything about Ruby and its ecosystem as well as other new web technologies. A long-time Free Software and Linux advocate, Cristian enjoys digging into deep technical aspects of programming languages and operating systems. When he is not with family, he is training for his next ultra trail race.\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/author\\\/c-molina\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Accessing an External Database Storage from a Bluemix-Based Ruby App | Altoros","description":"One of the many benefits that a PaaS provides is how easily you can extend its functionality with external services.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/","og_locale":"en_US","og_type":"article","og_title":"Accessing an External Database Storage from a Bluemix-Based Ruby App | Altoros","og_description":"In this article, we add a ClearDB connection to a sample Sinatra application running on Bluemix, addressing a very common need to read and save data dynamically. &nbsp; Adding the ClearDB service First, let\u2019s go to the Bluemix services catalog. In the Data and Analytics section, several storage facilities are available both from [...]","og_url":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/","og_site_name":"Altoros","article_published_time":"2016-03-22T11:24:06+00:00","article_modified_time":"2019-06-19T23:58:05+00:00","og_image":[{"width":693,"height":399,"url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-data-and-analytics-cleardb-1.png","type":"image\/png"}],"author":"Cristian Molina","twitter_misc":{"Written by":"Cristian Molina","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#article","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/"},"author":{"name":"Cristian Molina","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/c80777ff65c90ca4979b46cc79d1310b"},"headline":"Accessing an External Database Storage from a Bluemix-Based Ruby App","datePublished":"2016-03-22T11:24:06+00:00","dateModified":"2019-06-19T23:58:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/"},"wordCount":402,"commentCount":0,"image":{"@id":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-data-and-analytics-cleardb-1.png","keywords":["Cloud-Native","IBM Bluemix"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/","url":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/","name":"Accessing an External Database Storage from a Bluemix-Based Ruby App | Altoros","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#primaryimage"},"image":{"@id":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-data-and-analytics-cleardb-1.png","datePublished":"2016-03-22T11:24:06+00:00","dateModified":"2019-06-19T23:58:05+00:00","author":{"@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/c80777ff65c90ca4979b46cc79d1310b"},"breadcrumb":{"@id":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#primaryimage","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-data-and-analytics-cleardb-1.png","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/03\/ibm-bluemix-data-and-analytics-cleardb-1.png","width":693,"height":399},{"@type":"BreadcrumbList","@id":"https:\/\/www.altoros.com\/blog\/accessing-an-external-database-storage-from-a-bluemix-based-ruby-application\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.altoros.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Accessing an External Database Storage from a Bluemix-Based Ruby App"}]},{"@type":"WebSite","@id":"https:\/\/www.altoros.com\/blog\/#website","url":"https:\/\/www.altoros.com\/blog\/","name":"Altoros","description":"Insight","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.altoros.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/c80777ff65c90ca4979b46cc79d1310b","name":"Cristian Molina","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Molina_Cristian-140x140.jpg","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Molina_Cristian-140x140.jpg","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Molina_Cristian-140x140.jpg","caption":"Cristian Molina"},"description":"Cristian Molina wanted to be a programmer since he saw the first games on Atari 2600. Later, he started hacking with Basic, then C and Java. In the 2000s, he worked mostly with Java, developing web applications at companies in a wide range of industries: from media and communications to transportation, banking, and finance. After making the switch to full-time Ruby development in 2010, he's enjoying learning everything about Ruby and its ecosystem as well as other new web technologies. A long-time Free Software and Linux advocate, Cristian enjoys digging into deep technical aspects of programming languages and operating systems. When he is not with family, he is training for his next ultra trail race.","url":"https:\/\/www.altoros.com\/blog\/author\/c-molina\/"}]}},"_links":{"self":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/9205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/users\/54"}],"replies":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/comments?post=9205"}],"version-history":[{"count":4,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/9205\/revisions"}],"predecessor-version":[{"id":44438,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/9205\/revisions\/44438"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media\/44437"}],"wp:attachment":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media?parent=9205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/categories?post=9205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/tags?post=9205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}