Search code examples
mariadbodbcvba7

Connection to MariaDB Database on a Synology NAS via Excel VBA is denied


I'm trying to connect Excel VBA (Office 365, Windows 11) with a MariaDB Database. At first the MariaDB Server was running on my local machine and everything was running. But now the Database Server is running on a Synology NAS, which leads to the following error:

Access denied for user 'balu'@localhost' (using password: YES)

My code for creating the connection looks like this:

    Set conn = New ADODB.Connection
    conn.ConnectionString = "DRIVER={MariaDB ODBC 3.1 Driver};SERVER=10.0.0.4;PORT=3306;DATABASE=balu;USER=balu;PASSWORD=*****;"
    
    'SQL String
    strSQLBefehl = "SHOW TABLES FROM " & Datenbank & ";"
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseServer

    conn.Open
    rs.Open strSQLBefehl, conn

At the line conn.Open the error occurs.

I have a pyhton script, which is also running local and there the access to the database works. In this script I use the following code:

engine = sqlalchemy.create_engine("mariadb+mariadbconnector://balu:****@10.0.0.4:3306/balu")

The user has all privilegs for this database and this is the login information: enter image description here


Solution

  • I solved the issue. The problem was a special character in the password string. I replaced '!' through '&' and now everything works.