Re: How to pass password when opening DatasourceBrowser
Frank Schönheit <[email protected]> Fri, 01 Oct 2010 14:51:26 +0200
| Newsgroups | gmane.comp.openoffice.dba.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Fernand,
> Are you sure you didn' tryed with user/password before you tryed the
> activeconnection, because OO remembers the connection made by
> user/password ?
Yes.
> The code who works but is asking for User and pasdword:
>
>
> Dim aProps(7) as New com.sun.star.beans.PropertyValue
> aProps(0).Name = "DataSourceName"
> aProps(0).Value = "mysql_native" ' deze "naam" moet dus GEREGISTREERD ZIJN als Database in OO
> aProps(1).Name = "CommandType"
> aProps(1).Value = 0
> aProps(2).Name = "Command"
> aprops(2).value = "pmgdbase.mag_news_export"
>
> The code who do not works :
>
> oDB = CreateUnoService("com.sun.star.sdb.DatabaseContext")
> oConn =
> oDB.GetByName("mysql_native").GetConnection("user","password")
> ' xray oconn
> Dim aProps(7) as New com.sun.star.beans.PropertyValue
> aProps(0).Name = "ActiveConnection"
> aProps(0).Value = oconn
> aProps(1).Name = "CommandType"
> aProps(1).Value = 0 ' 0 = tabel , 1 = query , 2 = SQL statement
> aProps(2).Name = "Command"
> aprops(2).value = "pmgdbase.mag_news_export
One difference I see here is that you do *not* pass the DataSourceName
in the second case (my macro here does). This might make the difference
- can you try passing it, additional to the ActiveConnection?
Is your oconn object, by any chance, invalid?
Ciao
Frank
--
ORACLE
Frank Schönheit | Software Engineer | [email protected]
Oracle Office Productivity: http://www.oracle.com/office