Cypher
Cypher

Reputation: 2591

Jackcess -- How to change Column Name?

I have a Jackcess table and everything is working just fine. BUT I can't find anything on how to change a column name in the Jackcess table.

The reason I want to change the column name is that I have a ResultSet which is converted to Microsoft Access using Jackcess. a column is named "RELATION" but when Jackcess converts it, the name is changed to "xRelation". it must be some kind of Blacklisted word...

I want to change the column name back to "RELATION" and changing "RELATION" itself to something else is not an option.

How can I do this ?

Upvotes: 1

Views: 347

Answers (1)

Gord Thompson
Gord Thompson

Reputation: 123549

Jackcess cannot alter the structure of the table after it has been created. So, if you want that column to be named Relation instead of xRelation you will probably need to

  • explicitly create the table first (e.g., using TableBuilder) with Relation as the column name, and then
  • use ImportUtil.importResultSet to import into the table you created:
ImportUtil.importResultSet(rs, db, "ExistingTable", new SimpleImportFilter(), true);

That form of importResultSet will import into an existing table instead of creating a new one.

Upvotes: 1

Related Questions