{"id":9551,"date":"2016-04-06T21:01:55","date_gmt":"2016-04-07T05:01:55","guid":{"rendered":"http:\/\/blog.altoros.com\/?p=9551"},"modified":"2019-06-20T03:08:57","modified_gmt":"2019-06-20T00:08:57","slug":"adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix","status":"publish","type":"post","link":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/","title":{"rendered":"Adding a SQL Service to a .NET Application on IBM Bluemix"},"content":{"rendered":"<p>In this tutorial, we demonstrate how to connect a SQL service instance to an <a href=\"https:\/\/www.altoros.com\/blog\/how-to-push-an-asp-net-application-to-ibm-bluemix\/\">ASP.NET application<\/a> in Bluemix. For doing so, we also deploy a Node.js application to use it as an API for accessing the database. You can find the source code from the tutorial on <a href=\"https:\/\/github.com\/Altoros\/Bluemix.NET\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub<\/a>.<\/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\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#Prerequisites\" >Prerequisites<\/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\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#Creating_a_SQL_service_in_the_Bluemix_console\" >Creating a SQL service in the Bluemix console<\/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\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#Creating_a_Nodejs_application_for_Bluemix\" >Creating a Node.js application for Bluemix<\/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\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#Calling_a_Nodejs_API_from_an_ASPNET_application\" >Calling a Node.js API from an ASP.NET application<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#Related_reading\" >Related reading<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Currently, Bluemix supports IBM DB2, PostgreSQL, ClearDB, dashDB, and ElephantSQL as SQL services, so in the article, I decided to concentrate on IBM DB2. I hope that one day Microsoft SQL Server will be also available among Bluemix services.<\/p>\n<p>To follow the steps of this tutorial, you need:<\/p>\n<ul>\n<li>an <a href=\"https:\/\/cloud.ibm.com\/registration\/\" target=\"_blank\" rel=\"noopener noreferrer\">IBM Bluemix account<\/a> with a deployed ASP.NET application<\/li>\n<li><a href=\"https:\/\/nodejs.org\/en\/download\/\" target=\"_blank\" rel=\"noopener noreferrer\">Node.js<\/a> for Windows installed<\/li>\n<li>the IBM Bluemix CLI<\/li>\n<li>the Cloud Foundry CLI<\/li>\n<\/ul>\n<p>See also:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/how-to-push-an-asp-net-application-to-ibm-bluemix\/\">Pushing an ASP.NET 5 Application to IBM Bluemix<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Creating_a_SQL_service_in_the_Bluemix_console\"><\/span>Creating a SQL service in the Bluemix console<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>First, run the following command in the Command Prompt:<\/p>\n<pre style=\"padding-left: 30px;\"><code>cf services<\/code><\/pre>\n<p>The command shows a list of services connected to your account. Because we haven\u2019t created any, no services will be displayed.<\/p>\n<p>Now, let\u2019s create a service with this command:<\/p>\n<pre style=\"padding-left: 30px;\"><code>cf create-service sqldb sqldb_free sqlDb<\/code><\/pre>\n<p>The command above adds a new SQL DB service instance named <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">sqlDb<\/code> and the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">sqldb_free<\/code> plan.<\/p>\n<p>Run the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cf services<\/code> command again to see whether your new service is created. Here is what you should get:<\/p>\n<pre style=\"padding-left: 30px;\"><code>cf services\r\nGetting services in org altoros.bluemix.test1@gmail.com \/ space dev as altoros.bluemix.test1@gmail.com\u2026\r\nOK\r\nname    service   plan       bound apps  last operation\r\nsqlDB   sqldb     sqldb_free             create succeeded<\/code><\/pre>\n<p>The <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">bound apps<\/code> column is empty because we have created the service without connecting it to any Bluemix application. To solve this, I decided to connect the service to my ASP.NET 5 application. Sadly, after trying many different ways to bind them, I had no luck. To my surprise, I found out that the Bluemix SQL DB service <a href=\"https:\/\/console.bluemix.net\/docs\/services\/SQLDB\/index.html#SQLDB\" target=\"_blank\" rel=\"noopener noreferrer\">does not support<\/a> ASP.NET applications.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/getting-started-with-sql-database.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/getting-started-with-sql-database.png\" alt=\"getting-started-with-sql-database\" width=\"640\" height=\"360\" class=\"aligncenter size-full wp-image-9556\" \/><\/a><\/center><\/p>\n<p>As you can see, there is no ASP.NET in the list of compatible runtimes at the moment. So, I chose the Node.js runtime for binding our SQL DB service to the ASP.NET application.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Creating_a_Nodejs_application_for_Bluemix\"><\/span>Creating a Node.js application for Bluemix<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Now, let\u2019s go to the Bluemix Dashboard. When there, create a new web application and select <strong>SDK for Node.js<\/strong>.<\/p>\n<p><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/creating-a-nodejs-app-for-bluemix-sdk.png\" rel=\"attachment wp-att-9557\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/creating-a-nodejs-app-for-bluemix-sdk.png\" alt=\"creating-a-nodejs-app-for-bluemix-sdk\" width=\"640\" class=\"aligncenter size-full wp-image-9557\" \/><\/a><\/p>\n<p>Then, choose a name for your application and press the <strong>Finish<\/strong> button. As a result, Bluemix will create a Node.js application and generate a link. This application will provide an API for accessing the database service that will be used in our ASP.NET 5 application.<\/p>\n<p>I created a folder for my Node.js application with the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">package.json<\/code> file in it. In this file, I added two Node.js modules: <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">ibm_db<\/code> and <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">express<\/code>. The second module is optional.<\/p>\n<pre style=\"padding-left: 30px;\"><code>{\r\n  \"name\": \"testNodeJsWithAspnet5\",\r\n  \"scripts\": {\r\n      \"start\": \"node app.js\"\r\n  },\r\n  ...\r\n  \"dependencies\": {\r\n      \"ibm_db\": \">=0.0.1\",\r\n      \"express\": \">=4.0.0\"\r\n  },\r\n  \"engines\": {\r\n      \"node\": \">=0.10.3\"\r\n  }\r\n}\r\n<\/code><\/pre>\n<p>Now, we can open the Command Prompt and change the current directory to the folder with the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">package.json<\/code> file. Then, run the following command to install the required modules:<\/p>\n<pre style=\"padding-left: 30px;\"><code>npm install<\/code><\/pre>\n<p>In the application folder, I created the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">app.js<\/code> file based on <a href=\"https:\/\/hub.jazz.net\/project\/pvanrun\/SQLDBnode\/overview\" target=\"_blank\" rel=\"noopener noreferrer\">this sample application<\/a>. Here is the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">app.js<\/code> code:<\/p>\n<pre style=\"padding-left: 30px;\"><code>var express = require('express');\r\nvar app = express();\r\nvar host = (process.env.VCAP_APP_HOST || 'localhost');\r\nvar port = (process.env.VCAP_APP_PORT || 3000);\r\n\r\napp.use('\/cars', require('.\/routes\/cars'));\r\napp.listen(port, host);<\/code><\/pre>\n<p>I chose port 3000, but you can use a different port number. Also, I created the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">routes<\/code> folder and added the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cars.js<\/code> file to it. The .js file has the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">\/cars\/all<\/code> API method that retrieves all cars from the database. The key parts of the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cars.js<\/code> file are the following:<\/p>\n<pre style=\"padding-left: 30px;\"><code>var ibmdb = require('ibm_db');\r\nvar express = require('express');\r\nvar router = express.Router();\r\nrouter.get('\/all', function (req, res) {\r\n    res.writeHead(200, { 'Content-Type': 'application\/json' });\r\n    var env = null;\r\n    var key = -1;\r\n    var serviceName = 'SQLDB';\r\n    if (process.env.VCAP_SERVICES) {\r\n        env = JSON.parse(process.env.VCAP_SERVICES);\r\n        key = findKey(env, serviceName);\r\n    }\r\n    var credentials = env[key][0].credentials;\r\n    var dsnString = 'DRIVER={IBM DB2 ODBC DRIVER};DATABASE=' + credentials.db + ';UID=' + credentials.username + ';PWD=' + credentials.password + ';HOSTNAME=' + credentials.hostname + ';port=50001;PROTOCOL=TCPIP;Security=ssl';\r\n    ibmdb.open(dsnString, function (err, conn) {\r\n        var sqlQuery = 'SELECT Id, Model, Color FROM Cars';\r\n        conn.query(sqlQuery, function (err, data) {\r\n            res.write(JSON.stringify(data));\r\n            conn.close(function () {\r\n                response.end();\r\n            });\r\n        });\r\n    });\r\n});\r\n<\/code><\/pre>\n<p>The code above is a short version intended for understanding the main idea. The full version of the Node.js application can be found on <a href=\"https:\/\/github.com\/Altoros\/Bluemix.NET\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub<\/a>.<\/p>\n<p>To access the SQL DB instance from the Node.js application, we need to get the database credentials using the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">process.env.VCAP_SERVICES<\/code> variable that contains the database name, username, password, hostname, and <a href=\"https:\/\/cloud.ibm.com\/docs\/cli\/vcapsvc.html\" target=\"_blank\" rel=\"noopener noreferrer\">other related information<\/a>.<\/p>\n<p><strong>Note:<\/strong> The port number in the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">VCAP_SERVICES<\/code> variable is different from the one that we use in the Node.js application. To retrieve the correct port number, go to the Bluemix console, find the SQL DB service, and then launch the Database console.<\/p>\n<p><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/adding-a-sql-service-to-a-net-app-on-bluemix-database-console.png\" rel=\"attachment wp-att-9558\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/adding-a-sql-service-to-a-net-app-on-bluemix-database-console.png\" alt=\"adding-a-sql-service-to-a-net-app-on-bluemix-database-console\" width=\"640\" class=\"aligncenter size-full wp-image-9558\" \/><\/a><\/p>\n<p>While we are in the Database console, create the <strong>Cars<\/strong> table and add some data rows.<\/p>\n<p><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/ibm-sql-database-dashboard.png\" rel=\"attachment wp-att-9633\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/ibm-sql-database-dashboard.png\" alt=\"ibm-sql-database-dashboard\" width=\"604\" height=\"491\" class=\"aligncenter size-full wp-image-9633\" \/><\/a><\/p>\n<p>To finish with Node.js, do the last two steps in the Command Prompt:<\/p>\n<ol>\n<li>\n<p>Deploy your application:<\/p>\n<pre style=\"padding-left: 30px;\"><code>cf push testNodeJsWithAspnet5 -b https:\/\/github.com\/cloudfoundry\/nodejs-buildpack<\/code><\/pre>\n<\/li>\n<li>\n<p>Bind the SQL DB service to the Node.js application:<\/p>\n<pre style=\"padding-left: 30px;\"><code>cf bind-service testNodeJsWithAspnet5 sqlDb<\/code><\/pre>\n<p>where:<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">testNodeJsWithAspnet5<\/code> is the name of the Node.js application.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">sqlDb<\/code> is the name of the SQL DB service instance.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>Now, we can open the Node.js application using the Bluemix URL and see the data from the Cars table created earlier.<\/p>\n<p><center><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/adding-a-sql-service-to-a-net-app-on-bluemix-cars-table.png\" alt=\"adding-a-sql-service-to-a-net-app-on-bluemix-cars-table\" width=\"640\" class=\"aligncenter size-full wp-image-9560\" \/><\/center><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Calling_a_Nodejs_API_from_an_ASPNET_application\"><\/span>Calling a Node.js API from an ASP.NET application<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>So far, we have a Node.js API with the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">\/cars\/all<\/code> method that can be easily used in our ASP.NET application. I have updated the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">Index<\/code> action in my <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">HomeController.cs<\/code>:<\/p>\n<pre style=\"padding-left: 30px;\"><code>public async Task&lt;IActionResult&gt; Index()\r\n{\r\n   using (var client = new HttpClient())\r\n   {\r\n       var result = await client.GetStringAsync(\"http:\/\/testnodejswithaspnet5.eu-gb.mybluemix.net\/cars\/all\");\r\n       return Json(result);\r\n   }\r\n}<\/code><\/pre>\n<p>Finally, we deploy the updated ASP.NET application to Bluemix:<\/p>\n<pre style=\"padding-left: 30px;\"><code>cf push eugenetestaspnet5 -b https:\/\/github.com\/cloudfoundry-community\/asp.net5-buildpack.git<\/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>Because Microsoft SQL Server is not available in Bluemix, I integrated the IBM SQL DB service into my ASP.NET application. At the moment, the ASP.NET runtime is not supported by SQL DB, so you need to have a sort of API to access the database.<\/p>\n<p>In my future posts, I will show how to work with different services from a Bluemix ASP.NET application.<\/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\/how-to-push-an-asp-net-application-to-ibm-bluemix\/\">Pushing an ASP.NET 5 Application to IBM Bluemix<\/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-5-app-with-mongodb-redis-and-carrierwave-to-ibm-bluemix\/\">Deploying a Rails 5 App with MongoDB, Redis, and CarrierWave to IBM Bluemix<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/deploying-a-goji-and-postgresql-application-to-ibm-bluemix\/\">Deploying a Goji + PostgreSQL App to IBM Bluemix<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we demonstrate how to connect a SQL service instance to an ASP.NET application in Bluemix. For doing so, we also deploy a Node.js application to use it as an API for accessing the database. You can find the source code from the tutorial on GitHub.<\/p>\n<p>&nbsp;<\/p>\n<p>Prerequisites<\/p>\n<p>Currently, Bluemix supports [&#8230;]<\/p>\n","protected":false},"author":103,"featured_media":44445,"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-9551","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>Adding a SQL Service to a .NET Application on IBM Bluemix | Altoros<\/title>\n<meta name=\"description\" content=\"Relational databases are the most common choice for .NET applications.\" \/>\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\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding a SQL Service to a .NET Application on IBM Bluemix | Altoros\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, we demonstrate how to connect a SQL service instance to an ASP.NET application in Bluemix. For doing so, we also deploy a Node.js application to use it as an API for accessing the database. You can find the source code from the tutorial on GitHub. &nbsp; Prerequisites Currently, Bluemix supports [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/\" \/>\n<meta property=\"og:site_name\" content=\"Altoros\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-07T05:01:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-06-20T00:08:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/ibm-sql-database-dashboard-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"604\" \/>\n\t<meta property=\"og:image:height\" content=\"491\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Eugene Lahansky\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eugene Lahansky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/\"},\"author\":{\"name\":\"Eugene Lahansky\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/41eafcad445ed8378c19eaaf9612668d\"},\"headline\":\"Adding a SQL Service to a .NET Application on IBM Bluemix\",\"datePublished\":\"2016-04-07T05:01:55+00:00\",\"dateModified\":\"2019-06-20T00:08:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/\"},\"wordCount\":865,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/ibm-sql-database-dashboard-1.png\",\"keywords\":[\"Cloud-Native\",\"IBM Bluemix\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/\",\"name\":\"Adding a SQL Service to a .NET Application on IBM Bluemix | Altoros\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/ibm-sql-database-dashboard-1.png\",\"datePublished\":\"2016-04-07T05:01:55+00:00\",\"dateModified\":\"2019-06-20T00:08:57+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/41eafcad445ed8378c19eaaf9612668d\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/ibm-sql-database-dashboard-1.png\",\"contentUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/ibm-sql-database-dashboard-1.png\",\"width\":604,\"height\":491},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Adding a SQL Service to a .NET Application on IBM Bluemix\"}]},{\"@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\\\/41eafcad445ed8378c19eaaf9612668d\",\"name\":\"Eugene Lahansky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/Lahanskiy.Evgeniy.jpg\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/Lahanskiy.Evgeniy.jpg\",\"contentUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/Lahanskiy.Evgeniy.jpg\",\"caption\":\"Eugene Lahansky\"},\"description\":\"Eugene Lahansky is a Solutions Architect at Altoros. With his extensive experience in .NET programming, he designs and develops web-based software for Windows platforms. Eugene also works with the UNIX stack of technologies, including NGINX, Docker, and Node.js.\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/author\\\/e-lahansky\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Adding a SQL Service to a .NET Application on IBM Bluemix | Altoros","description":"Relational databases are the most common choice for .NET applications.","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\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/","og_locale":"en_US","og_type":"article","og_title":"Adding a SQL Service to a .NET Application on IBM Bluemix | Altoros","og_description":"In this tutorial, we demonstrate how to connect a SQL service instance to an ASP.NET application in Bluemix. For doing so, we also deploy a Node.js application to use it as an API for accessing the database. You can find the source code from the tutorial on GitHub. &nbsp; Prerequisites Currently, Bluemix supports [...]","og_url":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/","og_site_name":"Altoros","article_published_time":"2016-04-07T05:01:55+00:00","article_modified_time":"2019-06-20T00:08:57+00:00","og_image":[{"width":604,"height":491,"url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/ibm-sql-database-dashboard-1.png","type":"image\/png"}],"author":"Eugene Lahansky","twitter_misc":{"Written by":"Eugene Lahansky","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#article","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/"},"author":{"name":"Eugene Lahansky","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/41eafcad445ed8378c19eaaf9612668d"},"headline":"Adding a SQL Service to a .NET Application on IBM Bluemix","datePublished":"2016-04-07T05:01:55+00:00","dateModified":"2019-06-20T00:08:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/"},"wordCount":865,"commentCount":0,"image":{"@id":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/ibm-sql-database-dashboard-1.png","keywords":["Cloud-Native","IBM Bluemix"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/","url":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/","name":"Adding a SQL Service to a .NET Application on IBM Bluemix | Altoros","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#primaryimage"},"image":{"@id":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/ibm-sql-database-dashboard-1.png","datePublished":"2016-04-07T05:01:55+00:00","dateModified":"2019-06-20T00:08:57+00:00","author":{"@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/41eafcad445ed8378c19eaaf9612668d"},"breadcrumb":{"@id":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#primaryimage","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/ibm-sql-database-dashboard-1.png","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/04\/ibm-sql-database-dashboard-1.png","width":604,"height":491},{"@type":"BreadcrumbList","@id":"https:\/\/www.altoros.com\/blog\/adding-a-sql-service-to-a-dotnet-application-on-ibm-bluemix\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.altoros.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Adding a SQL Service to a .NET Application on IBM Bluemix"}]},{"@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\/41eafcad445ed8378c19eaaf9612668d","name":"Eugene Lahansky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Lahanskiy.Evgeniy.jpg","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Lahanskiy.Evgeniy.jpg","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Lahanskiy.Evgeniy.jpg","caption":"Eugene Lahansky"},"description":"Eugene Lahansky is a Solutions Architect at Altoros. With his extensive experience in .NET programming, he designs and develops web-based software for Windows platforms. Eugene also works with the UNIX stack of technologies, including NGINX, Docker, and Node.js.","url":"https:\/\/www.altoros.com\/blog\/author\/e-lahansky\/"}]}},"_links":{"self":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/9551","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\/103"}],"replies":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/comments?post=9551"}],"version-history":[{"count":7,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/9551\/revisions"}],"predecessor-version":[{"id":44446,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/9551\/revisions\/44446"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media\/44445"}],"wp:attachment":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media?parent=9551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/categories?post=9551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/tags?post=9551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}