Skip to Content
Former Member
Jul 12, 2007 at 08:56 AM

how to get the primarykey columns of the table in SAP BI Java SDK



I'm new to sap BI Java SDK. I'm not getting how to get the primarykey columns, using BI JDBC Connector (for relational data sources).

If anybody knows, please let me know. its very very urgent task to be done in my project.

In the below following code....

I have written a code to connect to the database through resource bundle, reading table names, once user select table name, i need to show the primary key columns of that table to the user. here i'm not getting how to get the primary key columns .

Please send me the code if there is any method to find out the primarykey columns or a logic to get them.

I will be greatful to you.... if you can do this favour.

Please check out the following code ........

ManagedConnectionFactory mcf;

IConnectionFactory cf;

IConnectionSpec cs;

mcf = new JdbcManagedConnectionFactory();

cf = (IConnectionFactory) mcf.createConnectionFactory();

cs = cf.getConnectionSpec();

ResourceBundle rbLocal = ResourceBundle.getBundle(


Enumeration propnames = rbLocal.getKeys();

while (propnames.hasMoreElements()) {

String key = (String) propnames.nextElement();



cs.setPropertyValue(key, rbLocal.getString(key));


// Establishing the connection.

// The IBIRelational interface provides an entrypoint to access

// metadata and execute queries.

IBIConnection connection = (IBIConnection) cf.getConnectionEx(cs);

IBIRelational rel = connection.getRelational();

IBIQuery query = rel.createQuery();

String sqlStatement =


+ "BICQPERSON where type='pk'";

ResultSet rs =

IBIDataSet dataset = query.execute();