Maris Orbidans <[EMAIL PROTECTED]> writes:
> I know I can read constraint names from SYS.SYSCONSTRAINTS but can I get
> it from DatabaseMetaData?
>
> I am trying to get ha-jdbc synchronization working with my derby
> database. The problem is that ha-jdbc reads INDEX_NAMEs from
> DatabaseMetaData (with getIndexInfo) and assumes that column constraint
> has the same name and tries to drop it.
Not sure what your exact problem is, can you post a standalone repro?
I tried the following which worked:
st.execute("create table mytab (id int primary key, " +
"name varchar(50))");
:
s = con.createStatement();
DatabaseMetaData dbm = con.getMetaData();
rs = dbm.getIndexInfo(null, null, "MYTAB", false, false);
while (rs.next()) {
System.out.println("Table: " + rs.getString(3) + " Index: " +
rs.getString(6));
s.executeUpdate("alter table " + rs.getString(3) + " drop constraint "
+ rs.getString(6));
}
Dag