Yikes.. 9-pin D-SUB? probably some DIY A1200 keyboard hack...
There's a file on Aminet,
http://aminet.back2roots.org/pub/aminet/hard/hack/a2k2cttvKBD.lha containing some keyboard pinouts. But IIRC this file is swapped with
http://aminet.back2roots.org/pub/aminet/hard/hack/a2kVSA5hKBD.lha Anyways, download both and have a look. As for figuring out what color goes where, the best solution would be to have a look inside a A2/3/4000 keyboard and use a multmeter, inside the kevboard, the lead is connected to a 4-pin connector, simply measure what pins go where and have a look at the pinouts to figure out these 4:
+5vdc
GND
KbdData
KbdClock
Whatever color that's left over is shield ground, probably black, and slightly thicker than the others.
As for the CDTV keyboard connector, it's not a regular 6-pin mini-DIN, but some oddball 5-pin mini-DIN. So you will have to remove the excess pin on the connector (e.g. use a needle nose plier and twist it off). And, IIRC, the plastic tab in the connector will also need to be removed.
Oh, btw, if you happen to find a scrapped A2/3/4000 keyboard (with working cable, test with multimeter) then simply use this cable and wire an adapter looking at the aminet pinouts.
Hope this wasn't too confusing,
-Paul