Showing posts with label free. Show all posts
Showing posts with label free. Show all posts

Monday, March 25, 2019

Running Db2 Developer-C as Docker container

Container: Db2 the easy way
Last week I wanted to start testing some new Db2 features without going through the steps of installing that Db2 version. I turned to my local Docker installation, issued a single command and had Db2 up and running. Quite interesting, that command downloaded Db2, installed it, created a sample database. Here are the details.

Db2 Developer-C Edition as Docker Image

IBM provides a free Db2 edition, Db2 Developer-C Edition. It can be installed and used as Docker container, see here the Db2 Developer-C Edition in the Docker store. Once you have added it to your basket and checked out, you can download it and get information about how to configure it. Basically, only few values need to be set in an environment file (see db2_env_list below).

After adapting the environment file, I invoke the script (with a single command) to run Db2 on docker. If not downloaded yet, it obtains the container image, starts it, sets it up:

docker run -h db2server_ --name db2server --detach \
--privileged=true \
-p 50000:50000 -p 55000:55000 \
--env-file db2_env_list \
-v /home/hloeser/progs/db2:/database \
store/ibmcorp/db2_developer_c:11.1.4.4-x86_64


Thereafter, I can connect to Db2 using the usual tools and SDKs.

If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or LinkedIn.

Friday, July 25, 2014

Catching the mean chocolate thief with Raspberry Pi, Bluemix, and Cloudant


I always try to have some chocolate in my office, kind of as mood enhancer. But how to be sure that nobody else is going to plunder and pilfer my hidden treasures? So it was great that last week at the Developer Week conference in Nuremberg I got my hands on a Raspberry Pi (thank you, Franzis Verlag and Christian Immler) and that I know a little about IBM Bluemix. And here is the plan: Hook up my IBM-sponsored webcam to the RPi and then take, activated by a motion-sensor, a snapshot and upload the picture and metadata to a Cloudant NoSQL database. With a Bluemix-based application I could then have worldwide access to the "incident data" and catch the mean chocolate thief...

Raspberry Pi, motion sensor, and webcam
The first step is the hardware setup. Connecting the pins of infrared motion sensor to 5V, ground, and an IO port on the Rasperry, and then the webcam to the USB port is simple. The mini-computer already has LAN access which is important to access the Cloud services.

Next I logged into IBM Bluemix, the platform-as-a-service (PaaS) offering for developers and created a Cloudant data store. This is done similar to how I described it in my previous article on using Cloudant for some statistics for a weather webpage. The account data for the Cloudant database can be obtained in JSON format. I copied that information into a file "cloudant.json" and placed it into my project directory on the Raspberry Pi. With that, we are already at the software part of this project.

In the following, you see the Python script I used for the prototyping. It is performing some setup work which includes reading in the access information for the Cloudant account. The main part is a simple loop waiting for the thief to appear, i.e., the motion sensor to be actived:

 import datetime  
 import time  
 import subprocess  
 import RPi.GPIO as io  
 import json  
 import couchdb  
 io.setmode(io.BCM)  
   
 pir_pin = 18  
 scriptPath='/home/pi/projects/officeCam/takeSnap.sh'  
 imgFile='/home/pi/projects/officeCam/office.jpg'  
   
 # couchDB/Cloudant-related global variables  
 couchInfo=''  
 couchServer=''  
 couch=''  
   
 with open("cloudant.json") as confFile:  
   couchInfo=json.load(confFile)['cloudantNoSQLDB'][0]  
   couchServer=couchInfo["credentials"]["url"]  
   couch = couchdb.Server(couchServer)  
   
 # access the database which was created separately  
 db = couch['officecam']  
   
 io.setup(pir_pin, io.IN) # activate input  
   
 while True:  
   if io.input(pir_pin):  
     subprocess.call([scriptPath])  
     f=open(imgFile,'r')  
     # basic doc structure  
     doc= { "type" : "oc",  
        "creater" : "RPi",  
        "location" : "office",  
        "city" : "Friedrichshafen"  
       }  
     doc["timestamp"]=str(datetime.datetime.utcnow())  
     # and store the document  
     db.save (doc)  
     db.put_attachment(doc,f,filename='cam.jpg')  
     f.close()  
   
     print("Alarm processed")  
   time.sleep(1)  
   


Once some motion has been  detected, the Python script invokes a shell script. It is printed below. The only action is to execute the fswebcam program which takes a snapshot with the webcam. Thereafter, back in Python, I create a JSON document, stuff the current timestamp and some other information into it and store it to the Cloud-based NoSQL database. As last step I attach the picture to that document, so that even if the mean chocolate thief notices the trap, the image is secured in the cloud.

   
 #!/bin/sh  
 fswebcam -q -c /home/pi/projects/officeCam/fswebcam.conf  


With that I am done with the Raspberry Pi. What is left is to work on the reporting. See how it is done in Python on Bluemix and Cloudant.

Friday, November 26, 2010

Black Friday Special: DB2 for free (no MIR required)!!!

We have THE most important shopping day in the US today: Black Friday. Shops are trying to lure in shoppers with rebates and specials, some require complicated mail-in rebates (MIRs). Let me point you to a very valuable product and it is entirely free and doesn't require a mail-in rebate: DB2 Express-C.

The free product includes free autonomics and free pureXML and much more. Get DB2 Express-C today and if you want some great free books and tools, let me know.

Wednesday, February 11, 2009

Organic Food and pureXML (now included in core DB2 license)

When I go shopping for groceries I have many choices. More and more often I choose organic products because of their better ingredients and their quality. It's not always an easy decision because organic food usually costs (significantly) more than regular food. But later, at the table, I am rewarded and it was worth the additional cost. What would I pick if the product with the better quality and better ingredients is offered at the same price? Easy answer.

That's my food talk today, now to something entirely different (really?). I am happy to tell you that the so far separately priced pureXML feature will now be included in the core DB2 for Linux, UNIX, and Windows. I would guess that for some companies it was hard to decide between an "all-included pricing" from another database vendor and DB2 which offered some premium technology as "additional cost features" (even though DB2 is priced differently) or to make the step from all relational to adding XML columns (and thereby requiring an additional license). The announcement is great news for customers, business partners, and IBMers alike as it becomes simpler to implement XML-based solutions. The announcement itself has the rationale behind this move:
[...] The packaging for DB2 V9.5 for Linux®, UNIX®, and Windows® is being updated to offer greater value to our users and customers. With the expanded usage of Web 2.0, service oriented architecture and the increasingly ubiquitous usage of XML throughout software tools and applications customers are finding XML being used in all parts of their IT infrastructure. To meet the needs of our customers' evolving needs the pureXML feature will now be included in all editions of DB2 for Linux, UNIX and Windows. Customers will now be able to leverage the new pureXML features in DB2 V9.5 such as; parameter passing from SQL to XQuery, trigger support on XML columns, schema evolution, and sub-document update shorten development timelines, helping faster delivery of business applications. [...]
My colleague Conor adds the following to it:

[...] Strong levels of XML adoption combined with strong levels of pureXML adoption are the driving force behind this development. Essentially, pureXML has emerged to become a core data type in much the same way as the traditional relational data types.

This reflects the large amount of information in XML format in organizations around the world. XML has emerged to become the ubiquitous data format for many applications and environments, driven by the adoption of industry formats like HL7 in the healthcare industry, ACORD in the insurance industry, FIXML and FpML in the financial services industries, SEPA in European Banking, NIEM in Government, XBRL for financial reporting, and so on. [...]

For those that haven't tried pureXML yet, now is the time - no more excuses. pureXML is now included in the core DB2 product for all editions. Download the (entirely) free DB2 Express-C and start exploring the pureXML functionality.