Database Abstration

I’m all for database abstraction in applications and code…

Panic: dynamic SQL (? placeholders) are not supported by the server you are connecting to (Damn you Microsoft!)

The above bit is the message I got when using Perl’s DBD::Sybase module to talk to Microsoft SQL using FreeTDS, whch technically, is a feat all in itself, but anyway, I’m all for database abstraction in applications and code. Jeremy thinks abstraction layers must die, and if I was someone who was an expert in one database, and got to choose to always use that one database, I might agree. Actually he goes on to say:

The author uses an argument I hear all the time: If you use a good abstraction layer, it’ll be easy to move from $this_database to $other_database down the road.

That’s bullshit. It’s never easy.

In any non-trivial database backed application, nobody thinks of switching databases as an easy matter. Thinking that “the conversion will be painless” is a fantasy.

Ok, the use of “non-trivial” makes this true depending on your definition of trivial, but some things might be considered trivial, and still be quite useful. Some systems can easily swap which database they use very easily. I’ve managed to switch things between MySQL, SQLite, and Microsoft SQL with ease. Now granted, none of these things were enterprise-level, make-or-break application (I’m not at Yahoo!) but they’re important to me and the people who own the data.

Database portability doesn’t have to be a myth. It’s all data, right? Moving it from one system to another should not be a nightmare.

See Also: Database Abstraction Considered Harmful