Title: Custom DbAdapter

How do I write an adapter to support a database that is not yet supported?

You need to implement a custom DbAdapter. Most likely you won't have to do it from scratch and can extend a JdbcAdapter or one of the existing db-specific adapters.

If the adapter is for a database that we currently do not support and you are planning to donate it to Cayenne, you can do this first:

Implementation procedure is roughly the following:
It is a good idea to put all new adapter code in its own Java package, e.g. org.apache.cayenne.dba.mydb, as default resource loading depends on that.
Correct mapping is needed for the Modeler to do schema generation. Technically it is not required for the runtime. However types.xml should still be there.