mysql and c++ in vs 2010: sqlstatementhandle and connection error - c++

I finally solved my problem:
I had been using a lib of mysql that was not compiled with the same settings as the VS10 project. Doing this solved my issue
This was my issue
I am having some trouble, and i was wondering if anyone could give me a push in the wright direction.
I am trying to connect to a local Mysql database, using c++ in VS 2010.
On phpmyadmin i can see that an attempt to connect is made but doesn't succeed.
When building the application, i get some errors.
The first where char* errors. I solved that by changing from unicode to multi byte.
The most important error, i think, is this one:
warning C4700: uninitialized local variable 'sqlstatementhandle' used.
After the application crashes i get this in visual studio:
Run-Time Check Failure #3 - The variable 'sqlstatementhandle' is being used without being initialized.
In the console i get this:
Connecting to SQL...
Connect() - SQL_ERROR
Message: [Microsoft][ODBC SQL Server Driver]Fout in het dialoogvenster
SQLSTATE: IM008
In the documentation i found that error code 008 refers to:
Dialog failed
SQLDriverConnect
But i don't really now how this can help? Is the driver not able to connect, or is the driver not loaded at all? As I told earlyer, i can see in phpmyadmin that there are failed attempts to connect.
my setup: visual studio 2010 and a mysql server administrated true Xampp. A 64bit windows 7 machine.

In connection string, Driver shows "Sql Server". Perhaps Connection String is problem. Try to change it. This site will help you.
http://www.connectionstrings.com/mysql#p31

Related

OPENSSL ERROR C++ 17 error:80000005:system library::Input/output error when passing path to client cert file

I am trying to create a TLS GUI Client using c++/WinRT.
The TLS Client I am using is https://github.com/embeddedmz/socket-cpp
For some reason when I try to connect to the socket server the connection fails when using the BlankApp(C++/WinRT Template) and no errors thrown.
When I test it with the blank console application, it works. Everything is the same across the board except the one being a console application and the other being a BlankApp(C++/WinRT Template) application.
Any ideas would be appreciated.
C++ Version: IS0 C++ 17 Standard
**Update 12/16/2022 **
I finally got OPENSSL to print errors to Visual Studio Debugger.
I have the following error.
Code that fails
int e = SSL_CTX_use_certificate_file(m_SSLConnectSocket.m_pCTXSSL, m_strSSLCertFile.c_str(), SSL_FILETYPE_PEM)
That function should return a 1 but returns -2147483643 and this is the error in I get from ERR_error_string method:
error:80000005:system library::Input/output error

MSB4018 The "ResolveComReference" task failed unexpectedly

I am currently trying to upgrade our c++ mfc solution from visual studio 2010 to a visual studio 2013 solution. When i try to build it i get the error MSB4018 The "ResolveComReference" task failed unexpectedly. I enabled fusion logging and this is what it tells me:
=== Pre-bind state information ===
LOG: DisplayName = System
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. ===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.EXE.
I understand that msbuild has been moved, but i dont understand why it is trying to find System.dll in the msbuild path, how can i make it look for it in its proper location?
Edit:
I have now also tried upgrading to visual studio 2012 which worked without bigger problems and I did not run into the same problem. However i noticed that when running devenv /upgrade (with vs2013) it seems to completely change everything under vc++ directories (it stayed unchanged when upgrading to vs2012). Could this have something to do with this issue?
Edit2:
Tried to build the project in vs2013 after upgrading it to 2012 (without running devenv /upgrade), this also didnt work so I guess the problem is not related to that...
After enabling diagonostic build output i found that it was 3 broken COM references in the project that where failing to load. Removing these references solved the building issue. These where only showing up as warnings in vs2010 but resulted in MSB4018 in vs 2013 for some reason.
This is your problem:
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
Fix the base folder in your build system if you really need it to point to another filder. However it would probably be better to redo you build system targeting 2013 instead of patching the 2010 version.

Qt & SSL, Handshake failed

I have a problem. I've made a Qt application which is connecting to a https site.
On my working machine, everything works fine. When I try to test my application on a clean Windows 7 machine, I observed the following issue:
After I have installed a fresh Win7 machine (installed all updates), after starting my application, I get a SSL Handshake failed error, SIGNAL(sslErrors(QNetworkReply*,QList)) is emitted with two empty error strings and error = QSslError::NoError.
I was really searching the whole day why this happens, also could reproduce it with examples\network\securesocketclient\release\securesocketclient and domain "google.com".
Now, I found out, that once I have started the internet explorer accessing https://www.google.com, my application is also working as expected and no further handshake errors are coming.
BTW, it does not matter which site you are accessing - this is not related to google.com.
Can someone explain to me why this happens? Is it a bug in OpenSSL, or Qt, or both?
UPDATE
I found a way to live with that issue for myself, implementing the following ignore logic:
QSslError ignoreNOErrors(QSslError::NoError);
foreach(QSslError error, errors)
if(error.error() != QSslError::NoError)
qDebug() << error.errorString();
QList<QSslError> expectedSslErrors;
expectedSslErrors.append(ignoreNOErrors);
reply->ignoreSslErrors(expectedSslErrors);
Thanks
You could ignore certificate verify using QSslConfiguration::setPeerVerifyMode():
QSslConfiguration conf = request.sslConfiguration();
conf.setPeerVerifyMode(QSslSocket::VerifyNone);
request.setSslConfiguration(conf);
I was facing the same issue on Mac with Qt 5.5 and 5.6. When I upgraded to 5.7 it is solved. Hope it may help if you are still facing this issue.
Have a look at this Qt bug
[This is padding for SO :D]

SQLBulkOperations Error HY092, Invalid Attribute/Option Identifier

SQLBulkOperations returns SQLState=HY092. The message is
[Microsoft][SQL Server Native Client 10.0][Invalid Attribute/Option Identifier].
I have tried everything, including the latest version of SQL server 2008 R2 Native Client Setup from Microsoft. I have used several differing databases and servers, with the same result. I am essentially using the sample code provided by Microsoft for SQLBulkOperations, although I have attempted modification of that code with the same result.

Connect to MS SQL Server through ODBC

I have a Qt 4 application that is trying to connect to an MS SQL Server 2008 database using the Qt ODBC driver. The application runs fine when it is running in Windows; however, the target OS for the application is to have it run in GNU/Linux. When the application runs in GNU/Linux I get the following error:
QSqlError(0, "QODBC3: Unable to connect", " [unixODBC][Driver Manager]Data source name not found, and no default driver specified")
Is there something I need to configure on the SQL server or application side to get the connection to work?
I don't really know much about unixODBC, but have a look here:
unixodbc.org/doc/
For connecting to MSSQL, the following might be useful:
http://www.unixodbc.org/doc/FreeTDS.html
or .../FreeTDS2.html
Try to copy the odbc.ini file in ~/.odbc.ini . If not working again, try to copy the same file into /etc/odbc.ini. If this is not working, as these directories are different for different Unix systems, find all files: *odbc*\.ini and see if some of them are empty. If so, replace them with the correct .ini file.
I had the same problem and this solved it. But it's a really stupid solution, so I'm looking for a better one. Hope that helped (: