| Bug #13871 | PK_NAME metadata object returns null value | ||
|---|---|---|---|
| Submitted: | 9 Oct 2005 12:12 | Modified: | 8 Nov 2005 14:15 |
| Reporter: | Hamza Essounni | Email Updates: | |
| Status: | Won't fix | Impact on me: | |
| Category: | MaxDB | Severity: | S1 (Critical) |
| Version: | 7.6 | OS: | Windows (Windows2000 SP4) |
| Assigned to: | Ulf Wendel | CPU Architecture: | Any |
[2 Nov 2005 13:56]
Ulf Wendel
Thanks for your report. I've forwarded the problem to the responsible developers. Regards, Ulf
[2 Nov 2005 16:11]
Ulf Wendel
Hamza, the developers are checking if MaxDB stores the "name of a primary key" in any public available system table. If this is not the case, then the JDBC driver can't return a name at all. Regards, Ulf
[8 Nov 2005 14:15]
Ulf Wendel
Hi, this is a missing feature. MaxDB does not store PK names anywhere. That's why the JDBC driver can't return any names. It won't be fixed in the near future. Regards, Ulf

Description: When trying to get the PK_NAME attribute value from the metadata catalog using a jdbc interface or sqlStudio nothing is returned,althought a primary key constraint was explicitly defined in the table. It seems that this is a problem related to the database catalog it self not to the jdbc driver. How to repeat: --first create the table create table USERS( login varchar(25) constraint pk_users primary key, password varchar(25)) // --or create table USERS( login varchar(25) not null, password varchar(25), constraint pk_users primary key(login)) // --"pk_users" is what should be returned in both cases public class SapMetaData( String db_name="demodb"; String user="dbadmin"; String pwd ="dbadmin"; public static void main(String[] arg){ try{ Class.forName("com.sap.dbtech.jdbc.DriverSapDB"); String url = "jdbc:sapdb:///"+db_name; con=DriverManager.getConnection(url,user,pwd); ResultSet rs=con.getMetaData().getPrimaryKeys(con.getCatalog(),"DEMO","USERS"); while(rs.next()){ System.out.println("the TABLE_NAME is "+rs.getString("TABLE_NAME")); System.out.println("the COLUMN_NAME is "+rs.getString"COLUMN_NAME")); System.out.println("the PK_NAME is "+rs.getString("PK_NAME")); System.out.println("the KEY_SEQUENCE is "+rs.getString("KEY_SEQ")); } } } } --this is what we get the TABLE_NAME is USERS the COLUMN_NAME is LOGIN the PK_NAME is null the KEY_SEQUENCE is 1 Suggested fix: make the value of the PK_NAME metadata attribute the some as the the primary key constraint name defined in the database schema.