Monday, July 6, 2009

JDBC Next Generation

In recent weeks the GeoTools developers have been working hard on moving a new set of data stores code named "JDBC Next Generation" to the supported part of the GeoTools library. And we are happy to announce that the work is complete!

The new JDBC data stores provide support for a variety of database back ends such as PostGIS, Oracle, DB2, and H2. MySQL and SQL Server are also supported but still lack a bit of functionality in terms of support for spatial indexing. So if you are a developer who would like to see first class support for these databases, please join us as volunteers, new contributors are always welcome. A data store for Spatialite is currently in the works as well.

The new data stores come with a number of benefits. One is support for prepared statements, which while improving security against SQL injection attacks, also improves performance in some cases such as Oracle. Prepared statements also provide better date/time handling. Another improvement is support for JNDI connections which allows data stores to use database connections defined by the environment, such as a Tomcat web container or an Oracle application server.

There are also plenty of benefits for the developer as well. The new architecture promotes much more code reuse via the use of "dialects", an idea taken from the Hibernate architecture. The upshot of which is that implementing support for new databases is much simpler and involves implementing a much smaller set of classes. Test coverage with the new data stores is also much increased with a built in test framework that makes it easy to add new tests.

Some projects like GeoServer have already started shipping the new data stores as extensions. Which means they have already received some good testing. The uDig developers are also planning to integrate the new data stores at their up and coming code sprint.