Jump to content

Using Services for Database Abstraction

by Patrick Leonard, VP Product Strategy

I’m flying home from visiting one of our customers, a large telecommunications company. They are using Rogue Wave(R) Hydra to create a C++ web service layer in front of their product database.

Apparently they were tired of having different internal groups all changing the common product database - picky, picky, picky… So this is a useful design pattern to them for several reasons:

  • It protects the integrity of the production database by giving a web service-based, CRUD interface but controls future changes to the database schema (this has been a problem for years)
  • It provides a performant programmatic web service interface for other internal applications needing access to this data - they implemented the services in C++ but could have used Java services in Hydra if they wanted to
  • People writing reads & writes no longer need to know the database schema, how to join tables etc. - this is handled for them
  • People writing reads & writes no longer need to worry about data validation or transactionality - this is handled for them

If you’re considering using services as the interface to your database, here are a few design & implementation thoughts to consider:

  • Service granularity is above the level of the database schema so that each operation (read, write, delete, etc) handles all related tables including joins, etc.  Avoid auto-generating services from a schema or from header files, as you’ll end up with very low level services and little abstraction.
  • Transactions are managed at the level of the WSDL operation so that each operation is atomic and external users simply need to call the web service and invoke the operation they need
  • They used C++ web services for this because it leveraged the skills of the team and provides better performance but this approach can be done with Java or other languages
  • They used Hydra’s Eclipse-based IDE for code generation of much of the service code from the WSDL interface

One developer had over 5,000 lines of C++ code completed in 5 weeks using Hydra in this project. They said that using Hydra’s Eclipse-based IDE saved a significant amount of time vs. what they were expecting.

This diagram shows a sample architecture and some design points for abstracting a production database with services.

Service Abstraction for Databases

Del.icio.us   |   Technorati   |   Digg   |   Slashdot

One Response to “Using Services for Database Abstraction”

  1. Ledell Says:

    People should read this.

Leave a Reply