Cannot assign parameters to drivermanager

Ok, here’s the deal:

I want to connect to mysql. The code is working, however, I cannot assign user and password to connecton, it allways returns error “you(logged username) are not allowed to connect.”

Properties are assigned like this:

Dim oParms(2) As New com.sun.star.beans.PropertyValue

oParms(0).Name = “user”

oParms(0).Value = “root”

oParms(1).Name = “password”

oParms(1).Value = “” 'or nothing, it doesn’t work with any; password is EMPTY

oManager = CreateUnoService(“com.sun.star.sdbc.DriverManager”)

sURL = “sdbc:mysql:mysqlc:hostname:port/database”

oCon = oManager.getconnection(surl, oParms)

What the hell am I doing wrong? This is driving me nuts!

Hello,

For the user & password (your code should work; this is just alternative):

  Dim oParms() As New com.sun.star.beans.PropertyValue
  AppendProperty(oParms(), "user", "root")
  AppendProperty(oParms(), "password", "PASSWORD_HERE")

Also change oCon line to - cause of problem:

oCon = oManager.getConnectionWithInfo(sURL, oParms())

And of course, insure you have correct host/port/database names in sURL string.

The last line, getConnectionWithInfo, did the trick.

Thanks alot!