Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » Obtaining Foreign Keys via ODA connections and IResultSet?(ODA)
Obtaining Foreign Keys via ODA connections and IResultSet? [message #553109] Mon, 16 August 2010 13:42 Go to next message
Maurice Okunek is currently offline Maurice OkunekFriend
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 #553805 is a reply to message #553109] Wed, 18 August 2010 22:38 Go to previous messageGo to next message
Linda ChanFriend
Messages: 845
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 #553806 is a reply to message #553805] Wed, 18 August 2010 22:59 Go to previous message
Linda ChanFriend
Messages: 845
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:How to get (db2, oracle etc.) dialect SQL Query Parser
Next Topic:Obtaining Foreign Keys via ODA connections and IResultSet?
Goto Forum:
  


Current Time: Thu Apr 25 22:24:58 GMT 2024

Powered by FUDForum. Page generated in 0.03109 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top