Re: How to pass password when opening DatasourceBrowser
Fernand Vanrie <[email protected]> Fri, 01 Oct 2010 16:09:01 +0200
| Newsgroups | gmane.comp.openoffice.dba.devel |
|---|---|
| Message-ID | <[email protected]> |
On 1/10/2010 14:51, Frank Schönheit wrote:
> 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
NO i tryed that also :-)
> - can you try passing it, additional to the ActiveConnection?
>
> Is your oconn object, by any chance, invalid?
I can Xray it and it shows all details according to the wanted
connection, so ??
only passing the password to the com.sun.star.comp.dba.ODatabaseSource
password property works for me
Greetz
Fernand
> Ciao
> Frank