Re: [dba-dev] How to pass password when opening DatasourceBrowser

2010-10-04 Thread Frank Schönheit
Hi Fernand,

 You clueless, thats new for me :-)

Damn, that slipped my attention, normally I do not admit that :)

 I am still convinced thats your machine knows the Username and 
 passwords, or  your sytem is never asking for it :-) ?

If I replace the getConnection call to create the connection with
connectWithCompletion, then it actually asks for the user/password -
so: no, that's not the difference :)

Ciao
Frank



-- 
ORACLE
Frank Schönheit | Software Engineer | frank.schoenh...@oracle.com
Oracle Office Productivity: http://www.oracle.com/office

-
To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org
For additional commands, e-mail: dev-h...@dba.openoffice.org



Re: [dba-dev] How to pass password when opening DatasourceBrowser

2010-10-04 Thread Frank Schönheit
Hi Fernand,

 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

I'm clueless than :(

Ciao
Frank

-- 
ORACLE
Frank Schönheit | Software Engineer | frank.schoenh...@oracle.com
Oracle Office Productivity: http://www.oracle.com/office

-
To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org
For additional commands, e-mail: dev-h...@dba.openoffice.org



Re: [dba-dev] How to pass password when opening DatasourceBrowser

2010-10-01 Thread Fernand Vanrie

 Hey Frank ,

Thanks for the respons:

Wath i already tryed en yet again tryed

 oDB = CreateUnoService(com.sun.star.sdb.DatabaseContext)
 oConn = 
oDB.GetByName(mysql_native).GetConnection(username,password)


 Dim aProps(7) as New com.sun.star.beans.PropertyValue
 aProps(0).Name = ActiveConnection
 aProps(0).Value = oconn

but the browser stays empty ! ( i tryed with  table and sql Statement)

maybe you did wath i already found out:

- worked from a opened Basedoc ?
- you tryed first the code with datasourceName and made the connection 
manualy and then changed he code to activeconnection ?


i trye to connect to a MySQL datasource using the Native Connector

Greetz

Fernand



Hi Fernand,


   For opening a DataSourceBrowser I use following code

   Dim aProps(6) as New com.sun.star.beans.PropertyValue
   aProps(0).Name = DataSourceName
   aProps(0).Value = mysql_native
   aProps(1).Name = CommandType
   aProps(1).Value = 2 ' 0 = tabel , 1 = query , 2 = SQL statement

(I always recomment using com.sun.star.sdb.CommandType.* here, for
better readability of your code)


   aProps(2).Name = Command
   aProps(2).Value = SQL statement
  aProps(3).Name = ShowTreeView
   aProps(3).Value = false
   aProps(4).Name = ShowTreeViewButton
   aProps(4).Value = false

(note that ShowTreeView/Button are superseded (though still supported)
by Enable/ShowBrowser -
http://api.openoffice.org/docs/common/ref/com/sun/star/sdb/DataSourceBrowser.html#XInitialization)


   aProps(5).Name = ShowMenu
   aProps(5).Value = true
   aProps(6).Name = EscapeProcessing
   aProps(6).Value = false
   oDataSourcebrowser =
frame1.loadComponentFromURL(.component:DB/DataSourceBrowser,
_beamer, 0, aProps)

That works fine excepted that  the user is asked for a Username and
Password when  the  datasource is opened !

How can i avoid this behaviour by passing the username and password
within my code ?
I tryed to use a ActiveConnection where the Username and password are
passed... no luck

Hmm - I copied your code snipped, and added an ActiveConnection
parameter to aProps, containing an already established connection - this
worked like charm, as expected.

Sure you passed the right object, did not dispose it meanwhile, and the
like?


Neither UserName or Password are accepted as arguments 

No, those are indeed not supported.


thanks for any hint

The ActiveConnection is the way to go, and it usually works - not sure
what you do differently, sorry.

Ciao
Frank

-
To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org
For additional commands, e-mail: dev-h...@dba.openoffice.org



-
To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org
For additional commands, e-mail: dev-h...@dba.openoffice.org



Re: [dba-dev] How to pass password when opening DatasourceBrowser

2010-10-01 Thread Frank Schönheit
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 | frank.schoenh...@oracle.com
Oracle Office Productivity: http://www.oracle.com/office

-
To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org
For additional commands, e-mail: dev-h...@dba.openoffice.org