简体   繁体   中英

ADO Connection to MariaDB

I try to connect in a C++ via Ado to a MariaDB Database.

CADODatabase m_dbConnection;

(my test.h)

m_dbConnection.SetConnectionString(strConnectionString);
m_dbConnection.SetConnectionTimeout(60);

Connection String is

DRIVER={MariaDB ODBC 3.1 Driver}; Server=xx.xx.xx.xx.xx; Port=3306; database=db; UID=8001; password=********;

I tried to setup a DSN but I don´t know how the connection string has to look like?

DSN=Name; 

Is it important if the program is a 32 or 64 bit version? which DSN is used in this case?

I always get the error:

Init(): Could not connect to database with connection string 'DSN=Cue1 DATABASE=yesdb'
Error message: Connection String = DSN=Cue1 DATABASE=yesdb
CADODataBase Error
Code = 80004005
Code meaning = Unspecified error
Source = Microsoft OLE DB Provider for ODBC Drivers
Description = [Microsoft][ODBC Driver Manager] Data source name not found and no default driver 
specified

or

Init(): Could not connect to database with connection string 'Driver={MariaDB ODBC 3.1 Driver} 
Server=xx.xx.xx.xx; Port=3306; database=db; UID=8001; password=xxxxxxx;Option=3;'
Error message: Connection String = Driver={MariaDB ODBC 3.1 Driver} Server=xx.xx.xx.xx; Port=3306; 
database=db; UID=8001; password=xxxxxx;Option=3;
CADODataBase Error
Code = 80040e73
Code meaning = IDispatch error #3187
Source = Microsoft OLE DB Service Components
Description = Format of the initialization string does not conform to the OLE DB specification.`

Any ideas?

Not sure what library you're using to connect.

CADODatabase m_dbConnection;

I'm not used to seeing CADODatabase. Your connection string looks like what I would expect using the MySQL ADODB library. But usually raw ADO connection strings use a property called "Provider"...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM