thee
thee

Reputation: 520

Check for column's character set and collation in JDBC

Is there a way to check if a certain MySQL column has a specific character set and collation with JDBC?

For those who need some background informations: The application I am working has changed its database layout with new versions. The update mechanisms was implemented rather basic: during startup, the application checks if the change is already there and, if not, alters the table accordingly. Right now I need to change an existing column to be unique and case sensitive (which means, I need to change the column's character-set and collation accordingly).

Upvotes: 4

Views: 1813

Answers (1)

Jess Balint
Jess Balint

Reputation: 1697

You will have to query it from INFORMATION_SCHEMA.COLUMNS. The CHARACTER_SET_NAME and COLLATION_NAME fields are what you need.

There is nothing in the JDBC spec that provides access to this.

Upvotes: 4

Related Questions