[ajug-members] OFFTOPIC: Referential Integrity via Foreign Keys

Johan Thorselius johan.thorselius at edgecode.se
Sun Sep 12 15:54:20 EDT 2004


I totally agree. It is the job of the database to enforce the referential
integrity.

I have seen several 'disaster projects' where they didn't use ref-integrity at
the database level.  In both the role as a DBA and a Java developer I like to
think about it as this - if the project and the solution is successful and it
will have a long life, which part of the solution will have the longest life ?
Most likely the data storage and the database model, I think. If you keep the
ref-integrity in the database you will always have it there, you don't have to
re-invent the wheel again in every new data access layer against this
database. And what if somebody wants to put a tool like Msoft Access on top of
you database ? (happend more than once in my projects, couldn't avoid it).

Johan

Eric Friedman wrote:

> I'm not sure what the norm is - and what is conventional but you are
> absolutely right. The database is good at doing RI - let the server do the
> work. It does not belong in the data access layer.
>
> Regards,
>
> Eric
>
> At 01:30 PM 9/12/2004, you wrote:
> >Sorry for the DB question here, but I respect the opinions of the people
> >here -
> >
> >I want to get opinions regarding the lack of referential integrity being
> >enforced at the DB level.  I think (in 99% of the cases) foreign keys
> >should be defined to allow the DB server to enforce RI.  Except for
> >cases where large DBs and huge volume is pushing the DB speed limits.
> >In that case, I can see doing away with FKs for efficiency.  The project
> >I just came into does all RI at the Data Access Layer.  And I think
> >that's risky for many reasons I would get into here.
> >
> >I don't need a lot of detail in your response.  Just let me know if you
> >agree that RI enforced at the DB server level is the norm and that not
> >using FKs is unconventional.
> >
> >Thanks,
> >
> >Scott
> >
> >_______________________________________________
> >ajug-members mailing list
> >ajug-members at ajug.org
> >http://www.ajug.org/mailman/listinfo/ajug-members
>
> _______________________________________________
> ajug-members mailing list
> ajug-members at ajug.org
> http://www.ajug.org/mailman/listinfo/ajug-members

----------------------------------------------------------------
Johan Thorselius, EDGECODE COMMUNICATION AB

web:  http://edgecode.com






More information about the ajug-members mailing list