Mobile phone detection (brand, model, browser etc)
This is not a direct answer, but I believe a valuable contribution. Of course applicability is dependent on your requirements, but I think many readers developing for consumers will find it useful and relevant.
To such a fine degree, I don't.
Of course, user-agent detection is great to serve an optimized mobile version for devices with good, standards-based browsers, such as Android phones, iPhone/iPod Touch, etc.
For practical purposes, "old school" mobile browsers are dead. Devices that people actually use the mobile web on today have great, capable browsers: WebKit, Opera, and Firefox Mobile. RIM just announced a built-in WebKit browser, and I feel they're the last major player to make the migration.
I've assumed your goal is simply redirection to a mobile website. If it's more complex, for instance, logging individual model numbers or tracking fine-grain statistics, these posts from Stack Overflow should prove helpful:
- Detecting mobile browsers from the HTTP request (from 2008)
- Browser detection vs. feature detection
- On not using JavaScript
- jQuery browser plugin (jQuery is written in JavaScript)
OMG, are you really keeping your own database up to date? I'm so sorry about you...
First tip: If you only need a very simple and minimal solution to detect brand and model, go with WURFL if you want it for free or DeviceAtlas if you can afford it. The second one probably works better (just my personal opinion).
Also, take a look at this comparision DeviceAtlas vs WURFL (dead link).
Second tip: As a general rule, it is a good idea to stay tuned with the W3C standards. In that sense, the DDR Simple API (Device Description Repository Simple API) is the way to go. It describes an abstract API to access Device Description Repositories (DDRs).
You can find an open-source reference implementation of that API in Java as part of MyMobileWeb project (dead link). It allows you to access WURFL, DeviceAtlas (not 100% sure), W3C DDR Core Vocabulary (and maybe UAProf). This way you can access device properties with a unified API, that is also offered as a REST service (see DDR REST service documentation).
You can download the latest 1.2 version. I know they are working in a new version that could probably be released by october and a Rails implementation.
What that means, in practice, is that you can develop your application using WURFL and later switch to another repository, keeping your code ideally untouched. It is harder to install and use for the first time, but if you are building a big enterprise system, you'll save a lot of time in the future.
I have to say I've previously worked on that project, I think it's worth a look in any case, despite W3C standards are usually hard to read. Maybe there are other alternative implementacions of the DDR Simple API out there.