[Closed] Can't remove password from LO Base connected to MySQL

Hi,
I have a database created on MySQL workbench that runs on my company server and I connected it to Base using this connector here MySQL Connector for OpenOffice.org | Apache OpenOffice Extensions .

I have several users (6 for now, but i plan on adding some more) and i didn’t have any problem whatsoever.
Today i tried removing the password from every user login autentication but it didn’t work. In the mysql workbench i removed the password (and i see the warning “no password” so i think it worked just fine) and in the base .obd file i unchecked the option “password required”.
When i try to acces the database it asks me for the password, I just press OK since there is no password to insert but then i get the error “Impossible creating the link to the “augeo” data source. User and password are mandatory” (i ruffly translated it from italian, sorry).

I already tried modifying the content.xml file as it’s said in this discussion here To reset password to default type but it didnt’ work, it still gives me the same error as before, the only difference is that now it doen’t even ask me for the user login, it just gives me the error .
I tried changing the connection, without the connector and with the direct connection but i still have the same error.
Do you have any solution for this?

Hello,

First let me state I don’t condone removing passwords as they are a method of protection for you and the company.

There are two methods which you can use. The actual method you are using will work using a JDBC driver from Oracle (obtained here). I just tested using connector v5.1.42 and it accepts a blank password. Conversly, as your question states, using a Native connector (SDBC) it always states password is required.

As a second option, without changing connectors, you can bypass the login dialog completely and leave the server password intact. This can be done with a macro tied to the Open Document event of the .odb file:

Sub AuthenticationTest
  dim sURL as string
  dim oArgs(0) As New com.sun.star.beans.PropertyValue
  dim oDocStatus as object
  dim oihandler
  oihandler = CreateUnoListener("InteractionHandler_", "com.sun.star.task.XInteractionHandler")
  sURL = "file:///home/YOUR_PATH_HERE/YOUR_FILE_NAME_HERE.odb"
  oArgs(0).Name = "InteractionHandler"
  oArgs(0).Value = oihandler
  oDocStatus = StarDesktop.loadComponentFromURL(sURL, "_default", 0, oArgs)
  oDocStatus.DataSource.Password = "LOGIN_PASSWORD_HERE"
  oDocStatus.setModified(0)
End Sub

You just need to place the relative information in the two lines of code for .odb path & user password.

If this answers your question please click on the :heavy_check_mark: (upper left area of answer).

1 Like

Hi, I tried writing the macro but it didn’t work … I still get the same error.
Do I need to create the macro in a specific folder? I placed it in my odb file folder.
Is it maybe because in our company we have a folder redirection for every computer? So the .odb file isn’t really on the :C of the computer but on the server.

The macro doesn’t go in a folder but in the .odb macro section. Did you attach it to the Open Document event of the .odb? Did you change the code for the .odb location & password? How to use macros can be found in the LO documentation, Chapter 9 - Macros; click here. Have tested this code and it works.

yes i changed the location and password and yes i attached the open document event. I can see the the program trying to load something but it gets stuck. Maybe I just wrote the wrong url in the sURL field?
I uploaded the image of the .odb file properties, in which you can see the url of the file and the macros with my changes… https://photos.app.goo.gl/siResDws405410eF2

@Asia1 Sorry for the confusion but your first comment read totally different from your last explanation. I don’t have a way to test with the setup you have but the URL you have doesn’t appear correct. Try replacing the ‘sURL’ line with this:

sURL = ConvertToURL("\\AUGEOSRV01\Folder Redirection\Stagista\Desktop\Augeo 1.0 MySQL.odb")

Just to be certain we’re on the same page, the Open Document event referred to is for the .odb main screen and not for a Form.

Thank you very much! It fixed the problem! I will close this question.