Error on CodeBocks c++ to connect to MySQL using SQLAPI++ - mysql

I am good at Code Blocks c++ 11, Python 3 and MySQL, recently I was trying to use SQLAPI++ to connect to MySQL.
I copied the codes from the official website http://www.sqlapi.com/Examples/step1.cpp and changed the database name, user name and password as required. The code compiles successfully but run into
the following error "Process returned -1-73741819(0xC0000005)".
I am running CodeBlocks 17.12 and MySQL 8.0 on Windows 10,
I searched for answers to the problem, in the link Unable to connect to MYSQL using SQLAPI++, the author Siddhant said, he used CodeBlock 10.0.5 and MySQL 5.5 to have fixed the error.
Do I have to go back to CodeBlock 10.0.5 and MySQL 5.5? Currently the database is working well with Python 3.
Thank you in advance for your help.

Solution: Re-compile CodeBlocks by 64-bits compiler, purchase the source code of SQLAPI++ and compile it by 64-bits compiler, then, Codeblocks c++ works well with SQLAPI++.

Related

MySQL Data Source Wizard not working on Visual Studio 2017

I have Visual Studio 2017 Community installed, and MySQL Community 8.0.12 on a same PC. It is also equipped with MySQL for Visual Studio 2.0.5 and MySQL Connector/NET 8.0.12.
Now, using the DataSource Wizard in Visual Studio. I was able to test the connection to my server and select which Tables that I wanted to add to the DataSet.
However when I click Finish, a following errors showed up:
"Some updating commands could not be generated automatically. The database returned the following error: Unexpected Error"
This is followed by another error log:
"Could not retrieve schema information for table or view [tablename]"
for every Table I wanted to add.
I already looked up to some information regarding the said errors, but so far they are talking about older version of Visual Studio and MySQL. Any help will be appreciated. Thank you.
So after some fiddling and looking into MySQL official website, I downgraded my Connector/NET to version 6.9.8, and downgraded the MySQL for Visual Studio as well to version 1.2.7
Now the DataSource is able to get table definitions and so on.
Still a minor error shows up whenever the "FINISH" button in DataSource wizard is pressed, that shows up "Failed to add relation(s) Specified cast is not valid".
This error however doesn't prevent the DataSource to be created and used. I'm still not sure what caused this error though.

How to connect Qt C++ program to an online MySQL database through ODBC (without MySQL Qt Driver compiled)

I was having the following problem that I resolved casually doing lot of attempts:
I need to connect my Qt application to an online mysql database, so I tried lot of times to connect my program to my database, but things didn't works.
At first I had problems to compile MySql driver for Qt, I followed every guide and topic on the web about that but I got always error, so I decided to use ODBC that it's ready for work without any compilation.
So I followed lot of guides and topics about the connection to MySQL through ODBC in Qt (including this: How to connect to a MySQL database through ODBC from Qt application?) but I got always errors also this time. The official documentation of Qt about this topic lacks and isn't updated but I resolved, with lot of attempts and lot of luck so this is the guide on how to connect Qt application to MySQL online database without compile any driver, let's start:
Follow this video: https://youtu.be/K3GZidOwGmM (download ODBC and configure your database as shown)
Create/Open your Qt project
Add to the .pro file the following line: QT += sql
Write the following code (obviously you have to change the hostname, username, ecc.. my parameters are only an example):
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC3", "Database"); // VERY IMPORTANT INSERT QODBC3 AND NOT QODBC
db.setHostName(something.yourhost.com);
db.setUserName(myusername);
db.setDatabaseName(mydatabasename);
db.setPassword(mypassword);
if(db.open()){qDebug()<<"Database opened!";}
else{qDebug() << db.lastError().text();}
If you followed all steps this should work
I spent lot of hours to unterstand how to do this cause to official lack documentation (that doen't work) and cause to lot of versions of Qt..
So i hope this little guide might help all the people that have problems about this topic :)

when deploying a system in 64bits using mysql

I have a problem my project made in vb2008 .net and using 32bit proccessor architecture and using mysql as a back end. And mysql.data and mysql odbc connector. In 32 bit architecture my system is working very well. But when i deploy it in 64bit i cant connect to database.. but i can open the database using the mysql administrator or mysql browser. And i got error "the type initializer for threw an exception" this is when checking if the connection state is close. Please help me.. sorry for bad english

MySQL Installer error on mysql-installer-community-5.6.21.1.msi

I was following the instructions, have downloaded mysql-installer-community-5.6.16.0.msi – 250.8MB, using this trying to add MySQL Server 5.6.21 - x64 from Available products, as soon as I select, I get an error - and have copied the error details - just wondering why I got stopped installing MySQL server, Thanks
System:
Windows 7 64 bit
It's bit weird as it mentioned in instructions, all have to do is to change the system time format, and it's installed successfully.

SOCI MySQL problems on OS X

My project is trying to incorporate SOCI for easy MySQL database access from C++. One of my teammates created a running SOCI test program in linux using the MySQL backend with only this link in his CMake file:
target_link_libraries(MyExecutable ${SOCI_LIBRARY})
Under Mac, however, when I try to run the program it errors out on the session creation line:
session sql("mysql", "service...")
with this error:
Error: Failed to find shared library for backend mysql
I definitely have MySQL installed and I definitely built SOCI with MySQL support, the make for SOCI even says it found MySQL libraries.
Should a CMake project using SOCI with a MySQL backend also link against MySQL or the SOCI MySQL plugin? I have tried going down that route but end up getting different runtime errors, like:
dyld: Library not loaded: libmysqlclient.18.dylib
Referenced from: MyExecutable
Reason: image not found
Any help would be greatly appreciated, I can provide our test program if needed, thanks!