| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Lecture - Getting Started with NoSQL

Page history last edited by Dr. Ron Eaglin 11 years ago

Getting Started with NoSQL

 

Summary of Video

 

Shows how to get started using DynamoDB on Amazon Web Service

 

Prerequisites

 

Visual Studio 2010 (or greater) and Amazon Web Service Account.

 

Video Link

 

http://online1.daytonastate.edu/player2.php?id=7486cef2522ee03547cfb970a404a874 

 

 

Support Materials

 

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithDDTables.html -  More information on loading data and other SDK links

 

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Amazon;
using Amazon.DynamoDB;
using Amazon.DynamoDB.DocumentModel;
using Amazon.DynamoDB.DataModel;
using Amazon.SecurityToken;
using Amazon.Runtime;
// Add using statements to access AWS SDK for .NET services. 
// Both the Service and its Model namespace need to be added 
// in order to gain access to a service. For example, to access
// the EC2 service, add:
// using Amazon.EC2;
// using Amazon.EC2.Model;
namespace AWS_App1
{
    class Program
    {
        private static AmazonDynamoDBClient client;
        public static void Main(string[] args)
        {
            try
            {
                AmazonDynamoDBConfig config = new AmazonDynamoDBConfig();
                config.ServiceURL = "http://dynamodb.us-west-2.amazonaws.com";
                
                client = new AmazonDynamoDBClient(config);
                
                UploadData();
                // Upload data (using the .NET SDK helper API to upload data)
                Console.WriteLine("Data uploaded... To continue, press Enter");
                
            }
            catch (AmazonDynamoDBException e) { Console.WriteLine("DynamoDB Message:" + e.Message); }
            catch (AmazonServiceException e) { Console.WriteLine("Service Exception:" + e.Message); }
            catch (Exception e) { Console.WriteLine("General Exception:" + e.Message); }
            Console.ReadLine();
        }
        private static void UploadData()
        {
            Table sampleTable = Table.LoadTable(client, "SampleData");
            var d1 = new Document();
            d1["id"] = "1";
            d1["Field1"] = "A field";
            d1["Field2"] = "Another Field";
            sampleTable.PutItem(d1);
            var d2 = new Document();
            d2["id"] = "2";
            d2["Field1"] = "A field 2";
            d2["Field2"] = "Another Field 2";
            sampleTable.PutItem(d2);
        }
    }
} 

 

 

 

 

All Materials Copyright 2012 Dr. Ron Eaglin

Comments (0)

You don't have permission to comment on this page.