Site icon IT World Canada

Windows Phone 7 gets open source database

A UK-based mobile software developer has ported an embedded database product to Microsoft’s Windows Mobile 7 operating system. The port creates an on-device database for individual Windows Phone applications, something so far missing from Microsoft’s radically redesigned mobile platform.

Perhaps best of all: it was really easy, at least for an experienced developer.

The database is the embedded, open source, object-oriented Perst product from McObject. It becomes a part of the developer’s Windows Phone application and manages record-based data kept in WP7’s “Isolated Storage” area, according to Andrew Wigley, a principal with the APPA Mundi, a Birmingham, U.K. software shop focused on Windows, where he specializes in mobile applications. Wigley blogged about the project and provided a link to three code samples.

The addition of robust data management for WP7 isn’t a big gain for many simple consumer-oriented mobile applications. But enterprise line-of-business applications often require much more complex object models. Currently, Perst is the only database management system available for WP7.

The new OS actually does incorporate a database: Microsoft’s embedded data store, SQL Server Compact Edition (CE). But initially, it’s only for Microsoft’s own built-in applications. There is no public API for it, so Silverlight developers can’t use it as a persistent data store for their own applications. Microsoft is also pushing SQL Azure, it’s cloud-based data storage technology, for Windows Phone 7 applications. But a cloud-based service requires a continuous connection.

“I wish I could say that it took a lot of top-class software engineering, but the truth is porting the database was quite simple,” Wigley says.

One big reason for the simplicity is that in January 2010, McObject announced its own port of Perst: to Microsoft’s Silverlight 3 tools and runtime for building rich Web client applications. With the port, McObject also released a demonstration application: a simple, Silverlight-based customer relationship management program. The goal was to let a laptop Web browser connect to a Web site for CRM data, with Perst creating a managing an on-board, managed store of that data. The application could then work on that data locally, without having to be connected to the original Web site.

“I just took their database code [and the CRM demo application] and basically removed the bits that wouldn’t compile in a Windows Phone object, and implemented a few workarounds for some other bits of code,” Wigley says. One thing missing in the port: Perst’s support for replicating data between databases. “In the end, I only changed 5% of the database code, but of course I invested quite a lot of my time working it out and testing it.”

Wigley, as all other Windows developers, has been using a variety of Microsoft tools for Windows Phone 7 development and the PC-base WP7 emulator program. Microsoft has said it will start releasing to Windows Phone developers “many thousands” of real prototype handsets with the latest OS build sometime this month. Handset makers and carriers are expected to introduce the first handsets sometime this fall.

In response to Wigley’s port, McObject announced last week it was supporting Windows Phone 7 for Perst, ahead of schedule, in part by incorporating Wigley’s change in the open source data base. It’s available on the Perst download page.

Perst, available for either Java or for Microsoft’s C# language (used for its .NET Framework), is designed as a full object-oriented database that can run fast with limited memory and low storage overhead, according to McObject.

But company executives say they were surprised by the Windows Phone 7 port, and the interest it has sparked. Chris Mureen, McObject’s chief operating officer, says they were using SocialOomph (previously know as TweetLater) to track Twitter references to Perst. They saw a “significant uptick” in tweets after Wigley blogged about the port.

Unlike the previous Windows Mobile OS, but like rival platforms such as Androic and Apple iOS, Windows Phone 7 applications are sandboxed: isolated from each other and the operating system as a security measure. “There is no way for apps on the phone to share data, other than if they both connect to a Web service that you’ve written for that purpose,” Wigley says.

Currently, the OS stores application data as serialized XML files, according to Wigley, “which is fine for simple data.” But using Perst gives “real “RDBMS-like capabilties,” making it simple to store, search and retrieve large volumes of data.

Wigley made available three code samples. One is the Perst port. Second is a code that lets you create, read, update, delete and search the WP7 contacts application, which includes a “Generate Data” feature that creates an hierarchy of related records in the database: contacts, activities and leads. “I just haven’t written the UI yet to allow the [sample] app to work with [these] latter record types,” he says.

The third sample is an AutoSuggestTextBox custom control, which permits full text search of the database. As you type text in the search box, it shows possible contact matches in a drop-down list.

Perst is available under the GPL license, and is free for non-commercial use. For commercial applications, there is a license fee. Another version, Perst Lite, runs in the Java ME (Micro Edition) runtime, which is deployed on BlackBerry devices.

McObject also offers a commercial product eXtremeDB, real-time embedded database. It was updated in May, with changes including faster on-disk storage and retrieval, new encryption options, and improved transaction logging.

Follow John Cox on Twitter: http://twitter.com/johnwcoxnww

Exit mobile version