On Mon, Apr 14, 2008 at 11:41 PM, Michael Schøler <michael@...
> --- In firstname.lastname@example.org, Mark Ireland <markincuba@...> wrote:
> > Is storing a JSON string in a database:
> > A: a crap idea. period.
> > B: a crap idea under most common circumstances
> > C: pure genius
> > Thanks. You've been helpful.
> Hi Mark,
> In a major project I'm currently involved in we had to consider how
> to store client side data and process it server side. JSON was one of
> the first suggestions. However, the database team (MS SQL 2005) did
> not like it one bit, because they could not do queries or perform any
> other programatic access to it "easily". Of course we all know that
> is not true but remember that JSON is more or less the scariest thing
> around to anyone other than us web folks.
Fundamentally there are 2 very distinct major classes of use cases:
those where data is mostly or completely access as a single entity
(one row, xml/json blob), and those where one need to deal with sets.
While RDBMSs aren't even optimal for the first use case, they are
often used for them too.
DBAs frown upon "store xml as BLOB" approach, yet that's generally the
most sensible way to do it: it's much much more flexible, doesn't need
complicated slice 'n dice logics to fit possibly complicated
structured data into simple relational model ("square peg through
round hole"), and inevitable structural changes do not result in
schema changes. For second case RDBMSs make sense, and it's more of a
question of how to bind data; json can at most be used as interchange
formats between data tier and processing (task which it can do better
than xml although both work ok).
In the second case, where queryability is needed, native xml databases
or object DBs would often be more optimal choices, but sometimes one
just has to work with whatever exists. And chances are that
corporations just have Oracle instances, independent of whether they
are good choice for various storage needs or not.
Personally, more often than not I like yet another combination:
storing json or xml docs in Amazon S3. But this is due to our use
cases (storing configuration data in versionable sets) and YMMV.
Anyway, one final note: the biggest thing IMO that is still mising
from json world are data binding tools: for Java, equivalents of JAXB
and Hibernate (binding between json and objects/relational model,
Once those exist, interoperability will be much easier to deal with
for most common cases.
-+ Tatu +-