Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » Accessing table for MySQL database
Accessing table for MySQL database [message #593732] Sat, 08 November 2008 19:18
Eclipse UserFriend
Originally posted by: andi.hotz.adsl.li

Here is something I can't get my head around: I can configure my MySQL
database so that it shows up in the Data Source Explorer and I can
access the table(s).
If I want to check the structure of the table from some piece of code I
retrieve a Database object retrieve the schemas and grab the tables.
Since MySQL doesn't care about schemas I tried to grab the catalogs with
the same result. Here is the piece of code:

public List<String> getOwner(IConnectionProfile profile, String factoryID){
Vector<String> v = new Vector<String>();
if (factoryID==null){
factoryID="java.sql.Connection";
}
IConnection conn = profile.createConnection(factoryID);
JDBCDatabase database = new JDBCDatabase((Connection)
conn.getRawConnection());
...
EList l = database.getCatalogs();
for (Iterator iterator = l.iterator(); iterator.hasNext();) {
Catalog s = (Catalog) iterator.next();
...
}
return v;
}

Irrelevant of the fact that I use database.getCatalogs() or
database.getSchemas() the result is always an empty list.

Based on the fact that it is possible to retrieve the data I must miss
something. Or is there another way to gather the meta data of a table?

Hope someone can help me out

Andi
Previous Topic:EclipseCon 2009 is now open for submissions!
Next Topic:Accessing table for MySQL database
Goto Forum:
  


Current Time: Tue Nov 25 02:04:51 GMT 2014

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

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