Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Correct Connection String VFP to MariaDB

dylim

Programmer
Dec 12, 2001
126
PH
Hi Guys,

I am trying to use MariaDB as an alternative to MySQL. So, I got MariaDB Server 11.4 installed on a test PC, also MariaDB ODBC 3.2.5.

I simply cannot seem to make it work!

This is the string I used:

lnHandle=SQLSTRINGCONNECT("Driver={MariaDB ODBC 3.2 Driver};Server=localhost;Port=3306;Database=MyDB;Uid=root;Pwd=12345;")

I also tried the following variations:

a) Driver={MariaDB ODBC 3.2 Driver}
b) Driver=MariaDB ODBC 3.2 Driver
c) Driver={MariaDB ODBC 3.0 Driver}
d) Driver=MariaDB ODBC 3.0 Driver
e) Driver={MariaDB ODBC 3.2.5 Driver}
f) Driver=MariaDB ODBC 3.2.5 Driver
g) Driver={MariaDB ODBC Driver}
h) Driver=MariaDB ODBC Driver

What is crazy is that, I used MySQL ODBC 8 (driver=MySQL ODBC 8.0 ANSI Driver), and it works like a charm!

Should I just use MySQL ODBC instead of MariaDB ODBC? (this seems very counter-intuitive though)

Thanks in advance!
 
One more thing to consider: MariaDB Server runs the MariaDB service that is mysqld.exe under the user MariaDB - more precisely NT SERVICE\MariaDB.

The data folder in the installation has MariaDB with full contol in Security. If your data folder is elsewhere or even on yet another networked computer, that would be something to look into.

You posted a change of your ini in that respect:
Code:
datadir=D:/MariaDBData
Since it works with the MySQL driver it's still not likely what differs, as that would affect any driver used.

To me it all sounds like you're using something completely different when using the MySQL Driver in the aspects of all other connection values or like another MySQL Server that also still runs on the same port. You can also step on your own feet doing something like that. Just remember the eror message of your connection speaks of an access violation.
 
Last edited:
One more thing to consider: MariaDB Server runs the MariaDB service that is mysqld.exe under the user MariaDB - more precisely NT SERVICE\MariaDB.

The data folder in the installation has MariaDB with full contol in Security. If your data folder is elsewhere or even on yet another networked computer, that would be something to look into.

You posted a change of your ini in that respect:
Code:
datadir=D:/MariaDBData
Since it works with the MySQL driver it's still not likely what differs, as that would affect any driver used.

To me it all sounds like you're using something completely different when using the MySQL Driver in the aspects of all other connection values or like another MySQL Server that also still runs on the same port. You can also step on your own feet doing something like that. Just remember the eror message of your connection speaks of an access violation.

Chriss,

Did you like tweak anything in MariaDB? More specifically, the file my.ini? Are you running on Windows 10 or 11?

Thanks.
 
No tweak, I'm running Win10. Also, I showed you screenshots of my setup and talked about it, didn't I? Can you please just read what I wrote?

And before you go Win10. I wonder why your error indirectly states the connection is already done. Try this and see whether it works when you don't try to connect to a database, only to the server:

HTML:
lnHandle=SQLSTRINGCONNECT("Driver={MariaDB ODBC 3.2 Driver};Server=127.0.0.1;Port=...whatever port you configured in setup...;Uid=root;Pwd=...whatever password you configured at setup...;")

You start with an empty server, you can't a) connect to a non existing database like "MyDB" before creating it and b) you can't just point my.ini to a directory of database files and neither set the permissions of the folder nor have this database in the system meta data tables of the server.
 
Last edited:

Part and Inventory Search

Sponsor

Back
Top