Difference between legacy and traditional?
The use of "legacy" in this case doesn't refer to any quality in the database itself, but rather that it represents an existing architecture or technology that you need to interface with when building a new system.
You could have a new system using a legacy Oracle or SQL Server as well, if that server pre-existed before your NHibernate-based system was designed.
Thus, "traditional" would not be a good fit here. Legacy carries specific connotations in computing, and traditional doesn't.
In technology, "legacy" as an adjective refers to an outdated or obsolete piece of software or technology that is still in use. This means that something newer is available that is intended to replace it.
For example, a serial port or parallel port on your PC are called "legacy" ports, as both have been replaced by USB ports. Most new computers do not have the old ports anymore, but you can still buy computers equipped with the legacy ports, if you want, and they are still useful for connecting to older equipment.
The word "legacy" has other definitions as a noun, as well, but as an adjective "legacy" almost exclusively refers to technology.
"Traditional" usually refers to something standard and ordinary. It could refer to anything, not just technology.
For example, I might talk about a traditional serial port on my PC. In this case, I'm not describing the fact that it is outdated; instead, I'm talking about the fact that it is an ordinary standard port and not something new, experimental, or special.
A third word that is related is "classic." This refers to something that is old, yet wonderful and better in many ways than newer options. If I talked about the classic serial port, I might mention how easy it is to get a home-built circuit to communicate to my computer using only three wires.
It's a subtle difference in some cases. In your sentence, when referring to DB2, if you wanted to emphasize that DB2 is outdated and has been replaced by better things, use the word "legacy." If you wanted to emphasize that DB2 is a standard database that is in wide-use and is not out-of-the-ordinary, you could use the word "traditional." And if you wanted to convey the message that DB2 is amazing with a proven track record, you could call it "classic."
"Legacy" can sometimes have more of a negative connotation, "traditional" has more of a neutral tone, and "classic" is positive.
Not only related to computers, the simple difference as I feel it:
There is some newer substitute for legacy thing, whereas traditional has not been improved.
Legacy is more like "We take it into account, but it is no longer alive or evolving."
Traditional is more like "We think about it as the only and best possibility."
In simplest terms legacy in this usage is synonymous with left-over or more to the point pre-existing.
For example: amongst other things, my father makes his living writing interfaces that allow access to outdated legacy systems. His clients have large databases full of indispensable information that for reasons of cost and time cannot be easily migrated to newer systems.
The notion of it being a legacy comes from the sense of it being something left behind by ones predecessors.
Traditional is not a direct synonym for legacy. Traditional means according to inherited or existing custom. While a tradition may be a legacy in and of itself, not all traditions are legacies and vice versa.
If you speak of a traditional database, you would only do so to contrast with a non-traditional database. i.e. One that uses some presumably different form of architecture from the norm.