5 messages in com.mysql.lists.plusplusRe: problem using 2 connections....
FromSent OnAttachments
Thomas Werth15 Sep 2004 00:10 
Steffen Schumacher15 Sep 2004 00:17 
Thomas Werth15 Sep 2004 04:59 
Steffen Schumacher15 Sep 2004 06:34 
Thomas Werth15 Sep 2004 22:32 
Subject:Re: problem using 2 connections....
From:Steffen Schumacher (ss@wheel.dk)
Date:09/15/2004 06:34:32 AM
List:com.mysql.lists.plusplus

On 15.09.2004 13:59:43 +0000, Thomas Werth wrote:

well i'm not using threads so parallel access to mysql is not possible. i don't want two threads share one connection nore use two connections parrallel in different threads. I just want to have two connections to two different databases. ( see my code ). On a second PC same code is running fine. I can't find any difference in setup of studio or mysql++ on both pc. What could i oversee ?

I only refered to my experience with running mysql from two threads, as an
example that you need to compile and build the library for mysqlclient so that it will handle multiple connections from the same process, but from different threads. If this is needed, we need to recompile mysqlclient with some options, which enable multiple MySql++ connections from the same process. (Again - go look at mysql.com to see which options)

The difference there must be between the two pc's must be the way mysqlclient is
built..

Steffen Schumacher schrieb:

Hi!

think that mysql has to be compiled for parallel connection from a single process. My experiences say that you have to compile mysqlclient in a special way if you wan't to be able to have parallel thread to have their own connection, and I also think there is a bunch of other special conditions one has to take into account too.

Go browse mysql homepage and look at the C API (which is what mysql++ uses..) and see what it says on the subject..

/Steffen

On 15.09.2004 09:10:49 +0000, Thomas Werth wrote:

hello,

i've problems using two connections at same time. When modifiyng simple1 example this way :

Connection con(use_exceptions); Connection con2(use_exceptions); //connect_sample_db(argc, argv, con); con.connect( "data", "pcxx", "user", "pwd" ); con2.connect( "test", "pcxxx", "user", "pwd" ); bool testi = con.connected(); Query query = con.query(); // This creates a query object that is bound to con.

query << "select user_id from user_data where benutzername='thomas.werth'"; // You can write to the query object like you would any other ostrem

Result res = query.store();

I got an access validation in query.store()... I'm using mysql-4.0.21-win and mysql++ 1.7.16 and set up my studio to look in those dirs for needed libs and headers. what could be the problem ?

-- MFG Thomas Werth

Tel.: 02307 / 704 - 366

---------------------------------------------------------------------

---------------------------------------------------------------------