Hello all, I got all things I need with the "XSingleServiceFactory":-)
May be a wrong code snippet in the DeveloperGuide... Bye Andre Am Montag, 4. Februar 2008 14:52 schrieb Andre Heine: > Hello all, > > I'm new to UNO and I want to create a swriter component with TextTables... > The TextTable should filled with Database contents... > > The basic works: > > I load the component with with "loadComponentFromURL()", that will work > fine for me... (private:factory/swriter) > > From this component I can create for example > a "com.sun.star.text.TextTable"... > > That will work, but I need a XMultiServiceFactory with the > "com.sun.star.sdb.DatabaseContext" service in there... > > I try to translate that "Java example" from the DeveloperGuide, but I don't > know how to create a compoment for databases;() > > > Here is an java example, which should show the registered databases, but I > can't translate it to C++;( > (see below...) > > My XMultiServiceFactory don't know the service > "com.sun.star.sdb.DatabaseContext"... > > So I thing I must create a "DatabaseComponent" and NOT a "swriter" > component... > > I tried the URL ".component:DB/DataSourceBrowser", but the returned XMSF is > NULL;( > > How can I get a valid XMultiServiceFactory for querying the datasources. > Which component I must load? > > any hints? > > Greetings Andre > > ----------- java example > // prints all data sources > public static void printDataSources(XMultiServiceFactory _rMSF) throws > com.sun.star.uno.Exception > { > // retrieve the DatabaseContext and > XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface( > XNameAccess.class, > _rMSF.createInstance("com.sun.star.sdb.DatabaseContext")); > > // print all DataSource names > String aNames [] = xNameAccess.getElementNames(); > for (int i=0;i<aNames.length;++i) > System.out.println(aNames[i]); > } > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]