VS2010 Release build says SQL is invalid. Is this a configuration issue?
Posted by: Rajesh Khan
Date: July 15, 2013 04:54PM

I am using the following code and I get this error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??]?j?X?0' at line 1

My code is as follows this works perfectly in the debug build

#include <iostream>
#include <vector>

/* MySQL Connector/C++ specific headers */
#include <driver.h>
#include <connection.h>
#include <statement.h>
#include <prepared_statement.h>
#include <resultset.h>
#include <metadata.h>
#include <resultset_metadata.h>
#include <exception.h>

int main()
sql::Driver *driver;
sql::Statement *stmt;
sql::ResultSet *res;
sql::Connection *con;
sql::PreparedStatement *prep_stmt;

/* Create a connection */
driver = get_driver_instance();
con = driver->connect("server", "user", "pass");

/* Connect to the MySQL database */

std::vector<std::string> SymbolList;
std::string SQL = "SELECT `MyList`.`Symbol` FROM `MySchema`.`MasterList`;";

stmt = con->createStatement();
res = stmt->executeQuery(SQL);
while(res->next()) //If object exists
std::string symbol = res->getString("Symbol");
std::cout << symbol;
catch(std::exception &ex)
std::string d = ex.what();

return 0;
}//end method

I am still confused by the error I am getting the code seems to work fine in debug mode but in release mode it gives this error out. Any suggestions on what I should try and what I might be doing wrong. I am using VS2010.I can also upload a small project that I created. The details of the project are as follows

Environment:VS2010 - C++
Installed : mysql-connector-c++-1.1.3-win32.msi

Options: ReplyQuote

Written By
VS2010 Release build says SQL is invalid. Is this a configuration issue?
July 15, 2013 04:54PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.