Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » Getting java.sql.Connection from org.eclipse.datatools.modelbase.sql.tables.Table?
Getting java.sql.Connection from org.eclipse.datatools.modelbase.sql.tables.Table? [message #570891] Wed, 01 March 2006 23:02
Josh Knauer is currently offline Josh KnauerFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,

I'm writing an org.eclipse.ui.popupMenus extension that is targetting the
org.eclipse.datatools.modelbase.sql.tables.Table object in Data Source
Explorer. What I would like the action to do is that if the table is JDBC
table, then use it to extract the JDBC connection information for the
connection that is containing table. The only way that I can figure out how
to do this is cast Table to
org.eclipse.datatools.connectivity.sqm.internal.core.rte.jdb c.JDBCTable and
then call getConnection to get the java.sql.Connection object which I cast
to a ConnectionAdapter. The ConnectionAdapter has a getConnectionInfo ()
which actually has what I want. My code looks something like this:

if (table isnstanceof JDBCTable)
{
JDBCTable jdbcTable = (JDBCTable) table;
ConnectionAdapter connection = (ConnectionAdapter)
jdbcTable.getConnection ();
ConnectionInfo info = connection.getConnectionInfo ();

String url = info.getURL ();
//etc ...
}

The trouble here is that I'm using JDBCTable, ConnectionAdapter and
ConnectionInfo which are all internal DTP classes.

Is it possible to get the connection information for a table using public
DTP classes?

Thanks!

Josh
Previous Topic:Can not see sql tools
Next Topic:Getting java.sql.Connection from org.eclipse.datatools.modelbase.sql.tables.Table?
Goto Forum:
  


Current Time: Fri Apr 26 23:02:49 GMT 2024

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

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

Back to the top