openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexandro Colorado <...@oooes.org>
Subject Re: Locating the interface that push the login information
Date Fri, 18 Jan 2013 23:33:13 GMT
On Fri, Jan 18, 2013 at 5:31 PM, Alexandro Colorado <jza@oooes.org> wrote:

> Looking at the following code, there is a discussion about the interface
> that handles the login information. Originally i thoguht XPropertyValue
> will be handling the login information, but that interface is just a
> container that needs to be passed to the database. When exactly the push is
> being done and by which interface? Other possibilities mentioned were
> XConnectionContext
>
> --
> Alexandro Colorado
> Apache OpenOffice Contributor
> http://es.openoffice.org
>
>
>
This is the code, is the sample code from the DevGuide about working with
Database:

// 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();
  }


-- 
Alexandro Colorado
Apache OpenOffice Contributor
http://es.openoffice.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message