cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

Hi,

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(

"xxxx");

Enumeration propnames = rbLocal.getKeys();

while (propnames.hasMoreElements()) {

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

//out.print(key);

//out.println("="rbLocal.getString(key)"<br>");

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 =

"SELECT * FROM "

+ "BICQPERSON where type='pk'";

ResultSet rs =

IBIDataSet dataset = query.execute();

Thanks

SreeKanth

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

looks like you are on Infomation Builders, correct? If yes through which adapter and to what DB are you connecting?? in an R3/BW system you can do the folowing:


"(ABAP)
SELECT DISTINCT FIELDNAME
FROM DD03L
WHERE TABNAME = '/BIC/QPERSON'
  AND AS4LOCAL = 'A'
  AND KEYFLAG = 'X'
ORDER BY 1

Another option is goto directly to the RDBMS; in this case let me which one are you using

hope this helps...

Olivier.

Message was edited by:

Olivier Cora

Answers (1)

Answers (1)

Former Member
0 Kudos

please send me the sample code urgent in getting primarykey columns from the database table........

Former Member
0 Kudos

if you don't provide "urgent" some details you won't get urgent support

Former Member
0 Kudos

Actually I'm writing the code in java using BI Java connector

(bi_sdk), and mysql database,

I need ur suggestion on " how to get the primarykey columns ?"

Is there any method to fetech primarykey columns in bi java sdk, if

there is, please let me know.

thanks