Suppose in my table I had a column defined with a default. e.g.
CREATE TABLE Orders (
...
Created DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)
Is there anyway to detect that this column has a default in JDBC? I see I can detect generated keys for the primary but I don’t see how to find this information?
TIA
The
DatabaseMetadata.getColumns(...)method returns aResultSetthat describes the columns of a table. TheCOLUMN_DEFfield of each result gives the default value for the corresponding column of the table, if any.