Primary Keys
You can use the getPrimaryKeys method to return information about the primary keys for BlackBaud Raiser's Edge NXT tables. You can restrict the results by the table name.
The following code example outputs the column or columns composing the primary key for the Constituents table:
String connectionString = "jdbc:raiseredgenxt:InitiateOAuth=GETANDREFRESH;SubscriptionKey=MySubscriptionKey;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;"; Connection conn = DriverManager.getConnection(connectionString); ResultSet rs = conn.getMetaData().getPrimaryKeys(null,null,"Constituents"); while(rs.next()){ System.out.println(rs.getString("COLUMN_NAME")); }
The getPrimaryKeys method returns the following columns:
Column Name | Data Type | Description |
TABLE_CAT | String | The table catalog |
TABLE_SCHEM | String | The table schema. |
TABLE_NAME | String | The table name. |
COLUMN_NAME | String | The column name. |
KEY_SEQ | short | The sequence number, or column index starting from 1, within the foreign key. |
PK_NAME | String | The primary key name. |