on 07-12-2007 9:56 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
please send me the sample code urgent in getting primarykey columns from the database table........
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.