Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » Obtaining Foreign Keys via ODA connections and IResultSet?
Obtaining Foreign Keys via ODA connections and IResultSet? [message #597866] Mon, 16 August 2010 09:42 Go to next message
Maurice Okunek is currently offline Maurice Okunek
Messages: 7
Registered: August 2010
Junior Member
Hi,

don't know if this is the right place for this.

I need to check if given rows are defined as foreign keys.
I'm using the following mechanism to obtain my ODAConnection instance via an IConnectionProfile from a ProfileManager:


IManagedConnection managedConnection = conprof.getManagedConnection("org.eclipse.datatools.connectivity.oda.IConnection ");
mConnection = (OdaConnection) managedConnection.getConnection().getRawConnection();
mConnection.open(conprof.getProperties("org.eclipse.birt.report.data.oda.jdbc "));

What i'm doing now is to obtain the resultset from a simple "select * from" query:


IQuery query = mConnection.newQuery(null);
query.prepare(object.getQuery());
IResultSet rows = query.executeQuery();


Until now everything works fine. But I were not able to find a solution for getting metainformations like Foreign Keys or similar. I've tried to do the following:


IResultSetMetaData data = rows.getMetaData();


But the the methods on IResultSetMetaData are not helpful for finding any Key related info.

Is there a way to obtain the needed infos with a ODA framework?

Thank you,
Maurice
Re: Obtaining Foreign Keys via ODA connections and IResultSet? [message #597884 is a reply to message #597866] Wed, 18 August 2010 18:38 Go to previous messageGo to next message
Linda Chan
Messages: 843
Registered: July 2009
Senior Member
The ODA framework itself mainly provides a common set of APIs for read access to heterogeneous types of data sources. If you need to get metadata specific to a data source, like JDBC metadata on foreign keys, you will need to use the underlying API itself.
From your connection profile, you can get the underlying JDBC java.sql.Connection instance from calling

conprof.getManagedConnection( "java.sql.Connection" ).getConnection().getRawConnection()

Linda
Re: Obtaining Foreign Keys via ODA connections and IResultSet? [message #597888 is a reply to message #597884] Wed, 18 August 2010 18:59 Go to previous message
Linda Chan
Messages: 843
Registered: July 2009
Senior Member
Some clarification to my last response, the DTP connectivity call to get java.sql.Connection is only applicable if you are using the DTP Database connection profile type, i.e. the BIRT data source type named "JDBC Database Connection for Query Builder".

If you are not using that, I'm afraid the current ODA API does not offer direct access to the underlying connection handle. Feel free to submit an enhancement request to add such an API.
In the mean time, you will have to extend and override the specific oda.jdbc driver's Connection class instead.

Linda
Previous Topic:Obtaining Foreign Keys via ODA connections and IResultSet?
Next Topic:JDBCDatabase.getSchemas returns an empty list!
Goto Forum:
  


Current Time: Wed Apr 16 19:02:24 EDT 2014

Powered by FUDForum. Page generated in 0.02419 seconds