Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 09:12 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 01:59 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.