Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all 529 articles
Browse latest View live

problems regarding including mysql++ libraries in a Makefile (no replies)

$
0
0
Hi all,

Kindly someone help me in resolving my problem. I want to include the mysql++ header file in a makefile or one software. Here is what I need to do. I have one open source software which doesnot provide any connectiity to database. I want to use MySQL database. The software is in C++. It hase its own configuration and makefiles. When I include mysql++ in header it gives error. The reason being that it cant link with the new libraries. I can run a simple program by including mysql++ and giving linkers information at compile time. But for this case since it is a big software I have to give that linkers info in the makefile.

Can somebody suggest how this can be accomplished. Kindly suggest some pointers atleast I can see specific sources.

Thanks
Sandeep

mysqlpp::Connection conn(false); causing glibc (no replies)

$
0
0
I have moved my program to my new computer that (to the best of my knowledge has all the same software installed).
Every time I try to connect to my database and server I get a glib c error. Double free and so on.
mysqlpp::Connection conn(false); causing glibc
Actually I can connect to the database and query it, but as soon as the connection closes it throws this error.
Why would it run fine on one laptop and the now the other with all the same programs installed.
Thanks,
Don

MySQL Connector/C++ and multiple stored procedures execution (3 replies)

$
0
0
Dear Friends,

I've received lately quite common (as I've researched) error, which occurs as following SQLException:

Commands out of sync; you can't run this command now

The problem is a bit complicated, that I'm not able to determine whether I'm doing something wrong, my database server is to old or anything else.

I've discovered, that when I'm sending queries to database,where I request for database VIEW mode, I'm able to loop them lots of times but when I request for stored procedure I receive an error.

My query function looks like so:

bool Database_Object::Query(sql::SQLString queryString, sql::ResultSet **resultSet) {
if(this->mysqlConnection != NULL) {
try {
this->mysqlStatement = this->mysqlConnection->createStatement();
if(this->mysqlStatement != NULL) {
if((*(resultSet) = this->mysqlStatement->executeQuery(queryString)) != NULL) {
delete this->mysqlStatement;
return true;
} else return false;
}
} catch( sql::SQLException &e ) {};
return false;
}

Of course in function where I work with ResultSet* after while(next()) loop I execute the resultSet->close().

The fact is, that while I'm not calling any stored procedures, my MYSQL log shows that my application starts and ends and sql::Connection opens and closes (while i "delete" the *Connection), ie:

Connect rally@192.168.0.66 on
Query set autocommit=1
Query SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ
Query SHOW SESSION VARIABLES LIKE 'lower_case_table_names'
Query USE `RR_virtual`
Query SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'
Query SELECT * FROM Team_Select_Teams T
Query SELECT * FROM Stage_Select_Active T
Quit [QQQ]

When I execute any stored procedure, my app ends but the "Quit" [QQQ] line in log file does not appear. What am I doing wrong?

I've found one topic here regarding the "sync exception", but it was left without any answers. I was wondering, whether the problem is actually solved in Connector/C++ - I have used the Connector/.NET in VC++ and as far as I remember I did not receive such exceptions, but maybe I did not use stored procedures so much.

The fact is, just after stored procedure call is fired, I'm not able to work with Connection handle anymore - after reconnecting, it works perfectly, but I presume the reconnection is not the solution for my problem ;)

Fortunately all other things are working fine except the stored procedures.
Any suggestions would be appropriated.

All the best,
Przemek M. Zawada

PS. Regarding environmental details:

MySQL Server Version
* Server version: 5.1.48-log FreeBSD port: mysql-server-5.1.48

MySQL Connector/C++ Version
* mysql-connector-c++-1.1.0

OS Details:
FreeBSD bsd2010.pmz 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:48:17 UTC 2009 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
gcc version 4.2.1 20070719 [FreeBSD]

the file "mysqlcppconn.dll" in mysql Connector/C++ 1.1 did not work (no replies)

$
0
0
I first download the Connector/C++ 1.1
Found the function export from the "mysqlcppconn.dll" not correct.
I use the "Dependency Walker"(depends) to check the function that
found:

only three function export correct.

get_driver_instance
get_driver_instance_by_name
sql_mysql_get_driver_instance


I download the Connector/C++ 1.1 source file, install Boost,
Cmake,complier with vs2008.
It did not work.


____________________export function
lists_______________________________
??0Connection@sql@@QAE@XZ
??0Driver@sql@@QAE@ABV01@@Z
??0Driver@sql@@QAE@XZ
??0InvalidArgumentException@sql@@QAE@ABU01@@Z
??0InvalidArgumentException@sql@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
??0InvalidInstanceException@sql@@QAE@ABU01@@Z
??0InvalidInstanceException@sql@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
??0MethodNotImplementedException@sql@@QAE@ABU01@@Z
??0MethodNotImplementedException@sql@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
??0MySQL_Connection@mysql@sql@@QAE@PAVDriver@2@AAVNativeConnectionWrapper@NativeAPI@12@AAV?$map@VSQLString@sql@@V?$variant@HN_NVSQLString@sql@@Uvoid_@0detail@boost@@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@@boost@@U?$less@VSQLString@sql@@@std@@V?$allocator@U?$pair@$$CBVSQLString@sql@@V?$variant@HN_NVSQLString@sql@@Uvoid_@0detail@boost@@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@U3045@@boost@@@std@@@6@@std@@@Z
??0MySQL_Connection@mysql@sql@@QAE@PAVDriver@2@AAVNativeConnectionWrapper@NativeAPI@12@ABVSQLString@2@22@Z
??0MySQL_Driver@mysql@sql@@QAE@ABVSQLString@2@@Z
??0MySQL_Driver@mysql@sql@@QAE@XZ
??0NonScrollableException@sql@@QAE@ABU01@@Z
??0NonScrollableException@sql@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
??0SQLException@sql@@QAE@ABV01@@Z
??0SQLException@sql@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z
??0SQLException@sql@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0H@Z
??0SQLException@sql@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
??0SQLException@sql@@QAE@XZ
??0SQLString@sql@@QAE@ABV01@@Z
??0SQLString@sql@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
??0SQLString@sql@@QAE@PBDI@Z
??0SQLString@sql@@QAE@QBD@Z
??0SQLString@sql@@QAE@XZ
??1Connection@sql@@UAE@XZ
??1Driver@sql@@MAE@XZ
??1InvalidArgumentException@sql@@UAE@XZ
??1InvalidInstanceException@sql@@UAE@XZ
??1MethodNotImplementedException@sql@@UAE@XZ
??1MySQL_Connection@mysql@sql@@UAE@XZ
??1MySQL_Driver@mysql@sql@@UAE@XZ
??1NonScrollableException@sql@@UAE@XZ
??1SQLException@sql@@UAE@XZ
??1SQLString@sql@@QAE@XZ
??2SQLException@sql@@KAPAXI@Z
??4Driver@sql@@QAEAAV01@ABV01@@Z
...
?substr@SQLString@sql@@QBE?AV12@II@Z
?threadEnd@MySQL_Driver@mysql@sql@@UAEXXZ
?threadInit@MySQL_Driver@mysql@sql@@UAEXXZ
get_driver_instance
get_driver_instance_by_name
sql_mysql_get_driver_instance
_________________________________________________________________________

SQLString.h Missing (1 reply)

$
0
0
I am unable to get the C++ connector for MySQL to compile with my project. I'm using MS VC++ 2008 and the latest version of MySQL server. I have installed MySQL with the development package (includes, libs) as well as the C/C++ connectors. When I add all the includes for the connector to my project and add directories to my project I fail to compile and get the error: "c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\warning.h(32) : fatal error C1083: Cannot open include file: 'sqlstring.h': No such file or directory"

I've searched all over my directories and cannot find sqlstring anywhere. How do I solve this problem?

undefined reference to `_imp__get_driver_instance' (no replies)

$
0
0
I am using Windows 7 x64 with Code::Blocks and GCC compiler vesion 4.4.1 and I am getting undefined reference to `_imp__get_driver_instance' error when I attempt to compile, I know its a linker error but I thought I had linked everything correctly.

Here is my configuration in cod::blocks, I hope you don't mind I uploaded screen shots to imageshack to make it easier to show.

Search Compiler settings
http://img684.imageshack.us/img684/903/cbcompiler.jpg
Search Linker settings
http://img214.imageshack.us/img214/8514/cbsearchlinker.jpg
Linker attempt 1
http://img641.imageshack.us/img641/9908/cblinker.jpg
Linker attempt 2
http://img522.imageshack.us/img522/4165/cblinker2.jpg

Someone please help I have been googling this for hours and I just want it to work already =(

/* Standard C++ includes */
#include <stdlib.h>
#include <iostream>

/*
  Include directly the different
  headers from cppconn/ and mysql_driver.h + mysql_util.h
  (and mysql_connection.h). This will reduce your build time!
*/
#include "mysql_connection.h"

#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>

using namespace std;

int main(void)
{
cout << endl;
cout << "Running 'SELECT 'Hello World!'AS _message'..." << endl;

try {
  sql::Driver *driver;
  sql::Connection *con;
  sql::Statement *stmt;
  sql::ResultSet *res;

  /* Create a connection */
  driver = get_driver_instance();
  con = driver->connect("tcp://127.0.0.1:3306", "root", "root");
  /* Connect to the MySQL test database */
  con->setSchema("test");

  stmt = con->createStatement();
  res = stmt->executeQuery("SELECT 'Hello World!' AS _message");
  while (res->next()) {
    cout << "\t... MySQL replies: ";
    /* Access column data by alias or column name */
    cout << res->getString("_message") << endl;
    cout << "\t... MySQL says it again: ";
    /* Access column fata by numeric offset, 1 is the first column */
    cout << res->getString(1) << endl;
  }
  delete res;
  delete stmt;
  delete con;

} catch (sql::SQLException &e) {
  cout << "# ERR: SQLException in " << __FILE__;
  cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl;
  cout << "# ERR: " << e.what();
  cout << " (MySQL error code: " << e.getErrorCode();
  cout << ", SQLState: " << e.getSQLState() << " )" << endl;
}

cout << endl;

return EXIT_SUCCESS;
}

Mysql doesn't have Backward Cursor? Is it true? (1 reply)

$
0
0
Someone told me MySql does not support Backward Cursor yet. You can only go forward. I am using C++ Connector and MySql 5.

Is it true?

How to set the query time out in Connector/c++(not mysql++)? (1 reply)

$
0
0
How to set the query time out in Connector/c++(not mysql++)?

Prepared Statement continuously returning null set (1 reply)

$
0
0
I'll admit I'm new at this (clearly, this being my second post in several hours). The basic setup is such: I'm currently using two C++ applications I wrote to connect to eachother. One machine serves as a log-in server, and is running MySQL with a users table as a background process. The other sends login data (handle and password) via WinSock2. The server received the info and queries the database. However, every time I query it throws an exception, and I have no idea how to fix it.

Running the same query using the MySQL command prompt yields a 1x1 table with the user's password.

Here is my code:

cout<<"Connecting to SQL database"<<endl;
m_SQLDriver = get_driver_instance();
m_SQLCon = m_SQLDriver->connect("tcp://127.0.0.1:3306/nebulous", "root", "**pass**");
m_SQLCon->setAutoCommit(false);

...

try
{
cout<<"Querying SQL Database"<<endl;

m_SQLPrepStatement = m_SQLCon->prepareStatement("SELECT password FROM users WHERE handle = (?)");
m_SQLPrepStatement->setString(1, handle);
m_SQLResultSet = m_SQLPrepStatement->executeQuery();

std::string Pass = password;

/*if(m_SQLResultSet->wasNull())
{
cout<<"Query returned null result."<<endl;
respond = LOGIN_RESULT_USERNAMEBAD;
}*/
if(Pass == m_SQLResultSet->getString("password"))
{
cout<<"Password match. Login successful."<<endl;
respond = LOGIN_RESULT_ACCEPTED;
}
else
{
cout<<"Password mismatch. Login FAILED."<<endl;
respond = LOGIN_RESULT_PASSBAD;
}
}
catch(sql::SQLException &e)
{
cout<<"ServerHandler::ReadPackets() Caught MySQL error on log-in attempt"<<endl;
cout<<"ERROR: "<<e.what()<<endl;
cout<<"/t(MySQL error code: "<<e.getErrorCode()<<endl;

respond = LOGIN_RESULT_MYSQLERROR;
}

If anyone has run into this before, or knows what I'm doing wrong (I'm sure there's plenty of it), I'd appreciate the help.

SQLString anomaly (no replies)

$
0
0
I've been having [many] issues configuring the C++ connector including an application crash from ResultSet::getString(""), app crash while getting a driver instance, countless link errors with no helpful information on how to resolve, etc...and have gotten a lot closer to getting the connector ironed out. I've looked at the source for sqlstring.h, and I'm not sure why the member realString is not being initialized in the SQLString constructor. Here's a simple example showing what I'm experiencing.

#include "boost/asio.hpp" // <-- Included to fix a preprocessor issue between boost and the mysql libs
#include "mysql_driver.h"
#include "mysql_connection.h"
#include "cppconn/statement.h"
#include "cppconn/sqlstring.h"
int main()
{
    sql::SQLString query("UNIX_TIMESTAMP()"); // <-- query.realString = null here.
	sql::mysql::MySQL_Driver* driver = sql::mysql::get_driver_instance();
    sql::Connection* connection = driver->connect("localhost", "root", "");
    connection->setSchema("generic");
	sql::Statement* statement = connection->createStatement();
	statement->executeUpdate(query); // <-- Crashes with a bad pointer (query.realString) here.
	return 0;
}

Can anyone shed some light on this?

Thanks.

* I was able to fix it by editing the source of the distributed sqlstring.h file.

dyld: Library not loaded: libmysqlclient.16.dylib (no replies)

$
0
0
Hi, trying to test connector c++ and am getting following error when clicking on the application when building http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-examples-complete-example-1.html - sounds like a linker error but I have tried linking the location where that library occurs:


Last login: Sun Oct 10 18:23:29 on ttys002
/Users/caseymongoven/Desktop/try_10/build/Debug/try_10 ; exit;
casey-mongovens-mac-mini:~ caseymongoven$ /Users/caseymongoven/Desktop/try_10/build/Debug/try_10 ; exit;
dyld: Library not loaded: libmysqlclient.16.dylib
Referenced from: /Users/caseymongoven/Desktop/try_10/build/Debug/try_10
Reason: image not found
Trace/BPT trap
logout

[Prozess beendet]

problem building mysql-connector-c++-1.1.0 from source on windows (1 reply)

$
0
0
Hello all,

I'm trying to compile using visual studio linking against mysql-connector-c-6.0.2

I used CMake using the following command line

cmake -G "Visual Studio 9 2008" -DBOOST_ROOT:STRING="c:\Program Files (x86)\boost\boost_1_42" -DMYSQL_INCLUDE_DIR:PATH=c:\opensource\mysql-connector-c-6.0.2\include\" -DMYSQL_LIB:FILEPATH=c:\opensource\mysql-connector-c-6.0.2\libmysql\libmysql.lib


Cmake generates the project files successfully.

However, while compiling from MYSQLCPPCONN.sln i get a bunch of compiler errors

2>c:\opensource\mysql-connector-c++-1.1.0\driver\nativeapi\native_resultset_wrapper.h(29) : fatal error C1083: Cannot open include file: 'config.h': No such file or directory
2>mysql_native_statement_wrapper.cpp
2>.\nativeapi\mysql_native_statement_wrapper.cpp(25) : fatal error C1083: Cannot open include file: 'sqlstring.h': No such file or directory
2>mysql_native_connection_wrapper.cpp
2>.\nativeapi\mysql_native_connection_wrapper.cpp(25) : fatal error C1083: Cannot open include file: 'sqlstring.h': No such file or directory
2>mysql_native_driver_wrapper.cpp
2>c:\opensource\mysql-connector-c++-1.1.0\driver\nativeapi\mysql_private_iface.h(55) : fatal error C1083: Cannot open include file: 'my_global.h': No such file or directory
2>mysql_client_api.cpp
1>c:\pensource\mysql-connector-c++-1.1.0\driver\nativeapi/mysql_private_iface.h(55) : fatal error C1083: Cannot open include file: 'my_global.h': No such file or directory
1>mysql_native_resultset_wrapper.cpp
2>.\nativeapi\mysql_client_api.cpp(27) : fatal error C1083: Cannot open include file: 'cppconn/sqlstring.h': No such file or directory
1>c:\opensource\mysql-connector-c++-1.1.0\driver\nativeapi\native_resultset_wrapper.h(29) : fatal error C1083: Cannot open include file: 'config.h': No such file or directory
2>mysql_warning.cpp
1>mysql_native_statement_wrapper.cpp
1>.\nativeapi\mysql_native_statement_wrapper.cpp(25) : fatal error C1083: Cannot open include file: 'sqlstring.h': No such file or directory


and more.

I know that it means that the compiler is not looking in mysql-connector-c++-1.1.0\cppconn for the include files but i don't want to modify the generated project files directly.
Is there a parameter to cmake that I can use to rectify this error?

Thanks a lot.

-Piyush

Unable to Connect to MySQL (no replies)

$
0
0
I'm using NetBeans 6.9.1 and cygwin C++ on Windows Vista (wampserver, mysql 5.1.36).

I'm unable to get a basic mysql connection to work and would really appreciate any advice!

This compiles fine. When I run it fails on driver->connect(). It gives me a segmentation fault. In debug mode, NetBeans says "Signal received: ? (Unknown Signal)" on the driver->connect line..

The mysql username and password are the correct ones. I'm not sure about whether I should be using "tcp:127.0.0.1:3306" - I just copied that from the example. I am running an apache server on 127.0.0.1.

I added all the mysql C++/Connector directories to my project properties libraries.

This is my example:

/*
* File: main.cpp
* Author: Aaron
*
* Created on October 11, 2010, 3:48 PM
*/

#include <stdio.h>
#include <time.h>
#include <math.h>


/*
examples/standalone_example_docs1.cpp
* From: http://blog.ulf-wendel.de/?p=216
*/

/* Standard C++ includes */
#include <stdlib.h>
#include <iostream>

/*
Include directly the different
headers from cppconn/ and mysql_driver.h + mysql_util.h
(and mysql_connection.h). This will reduce your build time!
*/
#include "mysql_connection.h"

#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>

using namespace std;

int main(void)
{
cout << endl;
cout << "Running 'SELECT 'Hello World!' AS _message'..." << endl;

try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;

/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "root", "");
/* Connect to the MySQL test database */
con->setSchema("test");

stmt = con->createStatement();
res = stmt->executeQuery("SELECT 'Hello World!' AS _message");
while (res->next()) {
cout << "\t... MySQL replies: ";
/* Access column data by alias or column name */
cout << res->getString("_message") << endl;
cout << "\t... MySQL says it again: ";
/* Access column fata by numeric offset, 1 is the first column */
cout << res->getString(1) << endl;
}
delete res;
delete stmt;
delete con;

} catch (sql::SQLException &e) {
cout << "# ERR: SQLException in " << __FILE__;
cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl;
cout << "# ERR: " << e.what();
cout << " (MySQL error code: " << e.getErrorCode();
cout << ", SQLState: " << e.getSQLState() << " )" << endl;
}

cout << endl;

return EXIT_SUCCESS;
}

SQLException - MEMORY_ALLOC_OPERATORS(SQLException) (no replies)

$
0
0
1>Compiling...
1>LsiApplication.cpp
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2059: syntax error : 'string'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2091: function returns function
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2802: static member 'operator new' has no formal parameters
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2333: 'sql::SQLException::operator new' : error in function declaration; skipping function body
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2059: syntax error : 'string'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2091: function returns function
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2556: 'void *(__cdecl *sql::SQLException::operator new(void))(size_t,void *) throw()' : overloaded function differs only by return type from 'void *(__cdecl *sql::SQLException::operator new(void))(size_t) throw(std::bad_alloc)'
1> c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : see declaration of 'sql::SQLException::operator new'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2059: syntax error : 'string'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2091: function returns function
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2556: 'void *(__cdecl *sql::SQLException::operator new(void))(size_t,const std::nothrow_t &) throw()' : overloaded function differs only by return type from 'void *(__cdecl *sql::SQLException::operator new(void))(size_t) throw(std::bad_alloc)'
1> c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : see declaration of 'sql::SQLException::operator new'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2059: syntax error : 'string'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2090: function returns array
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2059: syntax error : 'string'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2090: function returns array
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2556: 'void *(__cdecl *sql::SQLException::operator new(void))(size_t,void *) throw()' : overloaded function differs only by return type from 'void *(__cdecl *sql::SQLException::operator new(void))(size_t) throw(std::bad_alloc)'
1> c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : see declaration of 'sql::SQLException::operator new'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2059: syntax error : 'string'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2090: function returns array
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2556: 'void *(__cdecl *sql::SQLException::operator new(void))(size_t,const std::nothrow_t &) throw()' : overloaded function differs only by return type from 'void *(__cdecl *sql::SQLException::operator new(void))(size_t) throw(std::bad_alloc)'
1> c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : see declaration of 'sql::SQLException::operator new'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2059: syntax error : 'string'
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2091: function returns function
1>c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : error C2556: 'void *(__cdecl *sql::SQLException::operator new(void))(size_t,std::allocator<_Ty> &)' : overloaded function differs only by return type from 'void *(__cdecl *sql::SQLException::operator new(void))(size_t) throw(std::bad_alloc)'
1> with
1> [
1> _Ty=sql::SQLException
1> ]
1> c:\program files\mysql\mysql connector c++ 1.1.0\include\cppconn\exception.h(96) : see declaration of 'sql::SQLException::operator new'
1>Build log was saved at "file://d:\Serg\2005\iLabFilter\source\trunc\Filter\LastSaleInserter\Debug\BuildLog.htm"
1>LastSaleInserter - 21 error(s), 0 warning(s)



When comment next code al work right
//MEMORY_ALLOC_OPERATORS(SQLException)

C API for copying/duplicating a database (no replies)

$
0
0
Hi,
Is there a default C API for mysql that works similar to the mysqldump utility?
Basically i cannot call the mysqldump utility from my program.
I want to duplicate a database from the application.
Also if not , what would be the general technique used for this..


Thanks

Escaping Strings (4 replies)

$
0
0
What is the procedure to escape strings with the C++ connector API? Using the C connector there is a function called mysql_escape_real_string. Is there an interface to get to that or similar? I know that prepared statements can do this but that seems a round about way when all I want to do is escape a query.

Undefined symbol _get_driver_instance() Netbeans 6.9.1,Mac OSX 10.6.4 (no replies)

$
0
0
Hi every body!
I'm new to MySQL connector C++.
I've tried a sample code to build a simple application, that in hope to run on Mac OSX 10.6.4
IDE that i use: Netbeans C++ 6.9.1
The required libraries are installed.
But when built the app, i got the following error messages:

"Undefined symbols:
"_get_driver_instance", referenced from:
_main in main.o"

Can anyone could help me to solve this problem?
Thanks alot !

A problem for using mysql-connector-c++-noinstall-1.0.5-win32-vs2005 (no replies)

$
0
0
I write a mini software in vs2005(win32), which uses mysql database.
It works well in my computer (OS: Windows-XP-SP3). But it doesn't work in windows2003. I remove the codes about mysql, recompile it, it works.

Win2003 reports infomation:
Application nomally init (0xc01500002) failed. Please press "OK", stop the application.

How could I solve the problem ?
Please help me , thanks a lot.

MySQL Connector C++ 1.1 Dynamic linking causes run-time error. (1 reply)

$
0
0
Hi.

I am developing an x86 C++ application and I'm going to connect my application to my mysql 5.1 server. I am using Windows 7 Ultimate x64 and Visual Studio 2008 Team System x64 as my IDE. I have no problems building x86 applications on this setup. Except when I've run a dynamically linked MySQL Connector C++ 1.1 application I get the following error:

http://img832.imageshack.us/img832/9649/mysqlerror.png

Please note that I've been using the x86 version of the connector (because I am developing an x86 application remember). In my project I've set it up to include the include folders of the Connector and MySQL Server API. I've also put in the preprocessor CPPCONN_PUBLIC_FUNC= to the project to prevent the mysql_proxy warnings during compilation. I've also added the lib/opt folders of both MySQL server (libmysql.lib) and the Connector as well adding as additional libraries both libmysql.lib and mysqlcppconn.lib. I've also copied the compiled x86 version binary dlls (libmysql.dll and mysqlcppconn.dll) on the EXE path.


In Debug and Release builds, it compiles and links perfectly fine! BUT running the resulting EXE shows http://img832.imageshack.us/img832/9649/mysqlerror.png.

I also tried the mysqlcppconn-static but it just ends up having linker problems that I cannot solve. Static linking is out of the question now because I really need the dynamically linked now.

Please help me find the solution to this, it has been days and this has been haunting me!

Connector linking problem (2 replies)

$
0
0
I'm having a linking problem with MySQL Connector/C++.
I have included these files:

#include "mysql_connection.h"

#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>

and I cannot get these simple lines to work:

sql::Driver *driver;
driver = get_driver_instance();

Now I have gone into the project properties and added the additional include directory for "C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\include" (that is where it is installed on my computer) and added the additional library directories of "C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\lib\opt" and "C:\xampp\mysql\lib\opt" (Using xampp) and I have added the additional dependencies of mysqlcppconn.lib and libmysql.lib. However when to try to build the project I am getting an error:

"error LNK2019: unresolved external symbol __imp__get_driver_instance referenced"...

Looking around on various forums everyone says this is a linking problem. I have tried using the mysqlcppconn-static.lib and that did nothing at all. If I remove both dependencies mysqlcppconn.lib and libmysql.lib so that I have no additional dependencies for the project I still get the same error, so it is as though it is just ignoring the dependencies I'm providing.

I have also tried including:

#include "mysql_driver.h"

and then using:

sql::mysql::MySQL_Driver *driver;
driver = sql::mysql::get_mysql_driver_instance();

however I still get the same error when trying to build.

Anyone have any idea what I'm doing wrong?
Viewing all 529 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>