Joe Lennon

Rants, Raves & Recommendations

Archive for the ‘purexml’ tag

CSV data with Python/pureXML

without comments

This tutorial is geared towards developers who want to learn how to store data in XML format in a database, connect to DB2 from a Python application, and learn how to convert data from CSV files into XML documents. No prior knowledge of Python is assumed (you will learn how to install it in this tutorial), but it would be advantageous. This tutorial assumes that you use a Microsoft® Windows® operating system, but the code should work on other platforms without modification. When you complete this tutorial, you will have the skills to create powerful Python applications that can communicate and interact with an IBM DB2 database and harness the power that pureXML offers.

IBM® DB2® pureXML® allows you to store XML data natively in a relational database management system, giving you the power and flexibility to report on this data without disturbing the advantages that its XML format offers. In this tutorial, you will learn how to connect to a DB2 database from the Python programming language, importing data about population from the United States Census Bureau. You will use Python to convert this CSV file into XML, before inserting this XML data natively into DB2. Finally, you will use Python to create a command-line application that produces some informative tables that you can access through a menu system.

Read the tutorial at http://www.ibm.com/developerworks/xml/tutorials/x-csvdb2pytut/

Written by Joe Lennon

December 22nd, 2009 at 4:25 pm

Store Locator in ASP.NET

without comments

This tutorial is geared towards developers who want to learn how to store data in XML format in a database, connect to DB2 from a .NET application, and learn how to develop applications that leverage mapping APIs. To follow this tutorial, familiarity with the .NET framework and C# is recommended. You should also have some experience of developing with HTML and/or XML, and of communicating with a database management system using SQL. When you complete this tutorial, you will have the skills to create map-enabled .NET applications powered by a DB2 database using pureXML® to store XML natively.

We live in a connected and open world, one where data flows freely and where a vast amount of useful information can be found on the Web. In the past, if you wanted to find where the nearest store for your favorite retailer was located, you would probably look it up in the telephone directory, find the company’s phone number, call them, and ask for directions to their nearest outlet. This method is a recipe for getting lost, wasting time, and a general frustration for the customer. Today, however, this has all changed. Now you simply open your Web browser and visit the company’s Web site, where you can usually find a “Store Locator” feature that will help you find the store nearest to you, and conveniently plot it on a map to make it easier to find. In this tutorial, you will learn to develop such a feature using C# ASP.NET and an IBM DB2® database.

Read the tutorial at http://www.ibm.com/developerworks/xml/tutorials/x-purexmlasptut/

Written by Joe Lennon

December 9th, 2009 at 10:41 am

Alerts using XMPP/SMS

with one comment

This tutorial is aimed at Web application developers who want to develop database-driven applications that are powered by an IBM DB2 pureXML database. The reader should be familiar with basic PHP code and be able to work with the Windows command prompt in order to follow the tutorial. Some experience with database management systems and the SQL language is also required. By the end of this tutorial, you will learn how to create object-oriented PHP Web applications that take advantage of a pureXML database.

Thanks to the native XML support that pureXML® offers IBM DB2® database developers, you can load XML data directly into your database, freeing up development time to add functionality to your application. Follow along in this tutorial to import an XML file with Euro foreign exchange rates into an IBM DB2 database and use special XQuery and SQL/XML functions to split this XML into separate database rows. You will also create a PHP script that pulls down new rates from the European Central Bank (ECB) Web site each day. Then you will extend the script to send update alerts to a Google Talk user using the XMPP protocol, and to a cell phone by SMS text message using the Clickatell SMS gateway service. Finally, you will create a PHP script that generates a PNG (Portable Network Graphics) graph of this data.

Read the tutorial at http://www.ibm.com/developerworks/xml/tutorials/x-alertxmpptut/

Written by Joe Lennon

November 25th, 2009 at 12:03 pm

Posted in developerWorks,XML

Tagged with , , , , , , ,

Knowledgebase using PHP

without comments

One of the most useful and versatile technologies available in IBM DB2 is its native support for XML data through the pureXML feature. PureXML allows you to store, retrieve, and manipulate XML data alongside and in the same manner as relational data. This enables you to develop applications that harness the advantages of both relational databases and XML data. Such applications can be particularly useful when you have a large amount of XML data that you need to leverage without having to first convert it into a relational structure.

This tutorial gives you step-by-step instructions on how to use PHP to create a Support Knowledge Base system that stores its data using a combination of traditional DB2 relational columns and pureXML columns. The application uses the power of SQL/XML to map XML data as a relational column. This allows you to use PHP to retrieve the data as though it were stored in a relational manner.

Creating applications that use a hybrid of relational data and XML data is easy thanks to the pureXML® feature of IBM® DB2® database servers. In this tutorial, you use PHP to create a Web application that connects to an IBM DB2 Express-C database and stores some of its data in traditional relational database columns, and some of it in native XML columns. You also learn how to use SQL/XML queries to retrieve, insert, update, and delete data from this database. Beyond the hands-on, project-based training, the tutorial equips you with the skills and conceptual knowledge you need to develop your own hybrid applications.

Read the article at http://www.ibm.com/developerworks/data/tutorials/dm-0911db2purexmlphp/

Written by Joe Lennon

November 25th, 2009 at 11:47 am

Posted in developerWorks,XML

Tagged with , , , , ,

Leveraging pureXML, Part 3

without comments

In the third and final part of this series on creating applications that interact with an IBM DB2 pureXML database, you will use the popular PHP language to create scripts for publishing and syndicating the status updates in your database across the Web.

First you will allow users to create a Profile Badge in HTML, which permits them to generate a piece of HTML code to paste into their blog or Web site. This will pull the latest status updates from the pureXML database and present them in a pre-defined format. Users will be able to customize the design of the badge, choosing from a selection of sizes and color schemes, and define the number of updates to be displayed. Next, you will create a PHP script to publish the latest status updates in the database as an RSS Feed. Finally, you will create a script that presents all of the status updates in the database to the users with a Post to Twitter button alongside each update. When a user presses this button, the Twitter API will take the specified post and add the update to the Twitter stream of that user.

The pureXML® capabilities of IBM DB2® allow you to store XML natively in a database without modification, while Adobe® Flex® applications can read XML directly and populate Flex user interfaces. In this three-part article series, you will create a microblogging application that takes advantage of pureXML, Web services, and Adobe Flex; and even allows you to publish your microblogging updates on Twitter. In Part 1 of the series, you learned about Web Services and how they are enabled using DB2 pureXML as you created the microblog database and tested it. Part 2 tapped into Adobe Flex and ActionScript to create the user interface of your application. In this article, the final part of the series, you will learn how to use your pureXML Web Services to publish your microblog entries to an HTML page.

Read the article at http://www.ibm.com/developerworks/xml/library/x-db2mblog3/

Written by Joe Lennon

November 25th, 2009 at 11:36 am