To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=57664 Issue #:|57664 Summary:|DatabaseContext does not support XStorable interface Component:|api Version:|OOo 2.0 Platform:|All URL:| OS/Version:|All Status:|UNCONFIRMED Status whiteboard:| Keywords:| Resolution:| Issue type:|DEFECT Priority:|P2 Subcomponent:|code Assigned to:|sw Reported by:|alimaverde
------- Additional comments from [EMAIL PROTECTED] Thu Nov 10 03:59:00 -0800 2005 ------- Trying to add a new datasource using the code example from session 12.2.2 page 833 (Adding and Editing Datasources) result in NullPointeException. The line XStorable store = (XStorable)UnoRuntime.queryInterface(XStorable.class, xDs); Returns null. The code from developer guide: (I am using the RC2 release of the SDK and the final release of OpenOffice 2.0) // creates a new DataSource public static void createNewDataSource(XMultiServiceFactory _rMSF) throws com.sun.star.uno.Exception { // the XSingleServiceFactory of the database context creates new generic // com.sun.star.sdb.DataSources (!) // retrieve the database context at the global service manager and get its // XSingleServiceFactory interface XSingleServiceFactory xFac = (XSingleServiceFactory)UnoRuntime.queryInterface( XSingleServiceFactory.class, _rMSF.createInstance("com.sun.star.sdb.DatabaseContext")); // instantiate an empty data source at the XSingleServiceFactory // interface of the DatabaseContext Object xDs = xFac.createInstance(); // register it with the database context XNamingService xServ = (XNamingService)UnoRuntime.queryInterface(XNamingService.class, xFac); XStorable store = ( XStorable)UnoRuntime.queryInterface(XStorable.class, xDs); XModel model = ( XModel)UnoRuntime.queryInterface(XModel.class, xDs); store.storeAsURL(“file:///c:/test.odb”,model.getArgs()); xServ.registerObject("NewDataSourceName", xDs); // setting the necessary data source properties XPropertySet xDsProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xDs); // Adabas D URL xDsProps.setPropertyValue("URL", "sdbc:adabas::MYDB1"); // force password dialog xDsProps.setPropertyValue("IsPasswordRequired", new Boolean(true)); // suggest dsadmin as user name xDsProps.setPropertyValue("User", "dsadmin"); store.store(); } --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- 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]