Re: Connect to MySQL server from a c++ application

2012-06-06 Thread Lars Nilsson
On Wed, Jun 6, 2012 at 10:41 PM, Simon Walter  wrote:
> However, memory leaks are not acceptable. So I am open to suggestions. What
> do other c++ programmers use?

I've been happy using SQLAPI++ (http://www.sqlapi.com/) where I work.
Commercial and not open source, but it's cross-platform and supports a
dozen or so different databases.

One of the example programs (without comments and the wrapping try/catch block)

con.Connect("test", "tester", "tester", SA_Oracle_Client);
cmd.setConnection(&con);
cmd.setCommandText(
"Insert into test_tbl(fid, fvarchar20) values(:1, :2)");
cmd.Param(1).setAsLong() = 2;
cmd.Param(2).setAsString() = "Some string (2)";
cmd.Execute();
cmd << (long)3 << "Some string (3)";
cmd.Execute();
con.Commit();

Simply replace SA_Oracle_Client with SA_MySQL_Client, etc, and you'll
be working against MySQL. Only requirement is that the dll/so
libraries for each database you want to connect to are installed
properly.

Lars Nilsson

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Connect to MySQL server from a c++ application

2012-06-06 Thread Simon Walter


What is the most stable and performant way to connect to a MySQL server 
from a c++ application?


I've been using libmyodbc via unixODBC running under Debian squeeze. 
Suffice it to say, I am sorely disappointed. First of all the libmyodbc 
driver that's included with Debian is quite old. However, even after 
building and utilizing the latest version, there are still memory leaks 
in the driver.


I'm not stuck on using ODBC. Though it's nice to be able to is use an 
ODBC library so that I can connect to various DBs without having to 
learn new APIs. There is also the benefit of being able to change 
databases without much effort.


However, memory leaks are not acceptable. So I am open to suggestions. 
What do other c++ programmers use?


(note: I know this is probably not the place to ask this, but the 
libmyodbc mailing is dead as a door nail with people's auto-responders 
going off like a digital ghost town. :/)


Thanks,

Simon

--
simonsmicrophone.com


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: multi master auto syncing when servers back on line

2012-06-06 Thread Joey L
Can you tell me what permissions are needed for the user to run these
utilities so i can sync the tables ?
I have only assigned them replication slave right.
thanks


On Wed, Jun 6, 2012 at 9:09 AM, Andrew Moore  wrote:
> Joey, sounds like you've got a lot of testing to do before you can deploy
> and support this in production yourself with out fear of shooting yourself
> in the foot. Whilst you're trialling things, you could try 'XtraDB Cluster'
> from percona.
>
> A
>
>
> On Wed, Jun 6, 2012 at 5:09 AM, Joey L  wrote:
>>
>> My current situation arises out of testing really - i restored a db
>> that is out of sync with the other server (having less records) and
>> then i tried to update the "master" server - and only seen the records
>> that I updated and not the records that were additional to the other
>> server when I first restored.
>>
>> I am just trying different scenerios before i put this in production.
>> I was looking to do load balancing and i am concerned about
>> high-availablitity.
>> Is there a product that is opensource out there that I can use to
>> maintian a master master setup with ease ?
>>
>>
>> thanks
>> mjh
>>
>> On Tue, Jun 5, 2012 at 6:18 PM, Andrew Moore  wrote:
>> > Joey,
>> >
>> > The master master replication topology comes with it's own potential
>> > pitfalls and trials. Be sure your use case needs master master and that
>> > you're not implementing it because you think it's 'nice to have'.
>> >
>> > pt-table-sync should assist you getting your data in sync but how have
>> > you
>> > arrived at this out-of-sync predicament you find yourself in?
>> >
>> > A
>> >
>> >
>> >
>> > On Tue, Jun 5, 2012 at 11:03 PM, Joey L  wrote:
>> >>
>> >> with all do respect - I am new to this - i did read the docs and
>> >> having a hard time.
>> >> I also was asking if you know something easier or does the trick as
>> >> this utility does.
>> >> thanks
>> >>
>> >> On Tue, Jun 5, 2012 at 5:06 PM, Claudio Nanni 
>> >> wrote:
>> >> > Joey,
>> >> >
>> >> > from what I can see from your email you lack of a lot of basics and I
>> >> > suggest you to read some documentation before proceeding.
>> >> >
>> >> > Maatkit is now Percona Toolkit and contains some of the best tools
>> >> > for
>> >> > MySQL.
>> >> >
>> >> > Cheers
>> >> >
>> >> > Claudio
>> >> >
>> >> > 2012/6/5 Joey L 
>> >> >>
>> >> >> Hi -
>> >> >> I have setup mysql mult master setup on debian squeeze.
>> >> >> I have realized that the databases have to be initially in sync
>> >> >> before
>> >> >> multi master can operate properly.
>> >> >>
>> >> >> This can require a lot of down time on the one functioning server.
>> >> >> Is there a way to do an automatic sync from the 1 server that is
>> >> >> still
>> >> >> running ??
>> >> >>
>> >> >> I have found a tool dpkg package called Maakit , but having trouble
>> >> >> running it - get this error on the master:
>> >> >>
>> >> >>  mk-table-sync -u sl2 -ppswd --print --sync-to-master --replicate
>> >> >> mailserver 192.168.1.11
>> >> >> DBI
>> >> >>
>> >> >> connect(';host=192.168.1.11;mysql_read_default_group=client','sl2',...)
>> >> >> failed: Access denied for user 'sl2'@'mybox.somedomain.com' (using
>> >> >> password: YES) at /usr/bin/mk-table-sync line 1284
>> >> >>
>> >> >> can anyone assist with the error ?
>> >> >> Or can someone tell me of a better opensource tool to use to sync
>> >> >> the
>> >> >> servers without a mysql dump ? my db is rather large.
>> >> >>
>> >> >> thanks
>> >> >>
>> >> >> --
>> >> >> MySQL General Mailing List
>> >> >> For list archives: http://lists.mysql.com/mysql
>> >> >> To unsubscribe:    http://lists.mysql.com/mysql
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Claudio
>> >>
>> >> --
>> >> MySQL General Mailing List
>> >> For list archives: http://lists.mysql.com/mysql
>> >> To unsubscribe:    http://lists.mysql.com/mysql
>> >>
>> >
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:    http://lists.mysql.com/mysql
>>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: multi master auto syncing when servers back on line

2012-06-06 Thread Joey L
But andrew do you have an answer for me why i am getting this error ?

thanks

On Wed, Jun 6, 2012 at 9:09 AM, Andrew Moore  wrote:
> Joey, sounds like you've got a lot of testing to do before you can deploy
> and support this in production yourself with out fear of shooting yourself
> in the foot. Whilst you're trialling things, you could try 'XtraDB Cluster'
> from percona.
>
> A
>
>
> On Wed, Jun 6, 2012 at 5:09 AM, Joey L  wrote:
>>
>> My current situation arises out of testing really - i restored a db
>> that is out of sync with the other server (having less records) and
>> then i tried to update the "master" server - and only seen the records
>> that I updated and not the records that were additional to the other
>> server when I first restored.
>>
>> I am just trying different scenerios before i put this in production.
>> I was looking to do load balancing and i am concerned about
>> high-availablitity.
>> Is there a product that is opensource out there that I can use to
>> maintian a master master setup with ease ?
>>
>>
>> thanks
>> mjh
>>
>> On Tue, Jun 5, 2012 at 6:18 PM, Andrew Moore  wrote:
>> > Joey,
>> >
>> > The master master replication topology comes with it's own potential
>> > pitfalls and trials. Be sure your use case needs master master and that
>> > you're not implementing it because you think it's 'nice to have'.
>> >
>> > pt-table-sync should assist you getting your data in sync but how have
>> > you
>> > arrived at this out-of-sync predicament you find yourself in?
>> >
>> > A
>> >
>> >
>> >
>> > On Tue, Jun 5, 2012 at 11:03 PM, Joey L  wrote:
>> >>
>> >> with all do respect - I am new to this - i did read the docs and
>> >> having a hard time.
>> >> I also was asking if you know something easier or does the trick as
>> >> this utility does.
>> >> thanks
>> >>
>> >> On Tue, Jun 5, 2012 at 5:06 PM, Claudio Nanni 
>> >> wrote:
>> >> > Joey,
>> >> >
>> >> > from what I can see from your email you lack of a lot of basics and I
>> >> > suggest you to read some documentation before proceeding.
>> >> >
>> >> > Maatkit is now Percona Toolkit and contains some of the best tools
>> >> > for
>> >> > MySQL.
>> >> >
>> >> > Cheers
>> >> >
>> >> > Claudio
>> >> >
>> >> > 2012/6/5 Joey L 
>> >> >>
>> >> >> Hi -
>> >> >> I have setup mysql mult master setup on debian squeeze.
>> >> >> I have realized that the databases have to be initially in sync
>> >> >> before
>> >> >> multi master can operate properly.
>> >> >>
>> >> >> This can require a lot of down time on the one functioning server.
>> >> >> Is there a way to do an automatic sync from the 1 server that is
>> >> >> still
>> >> >> running ??
>> >> >>
>> >> >> I have found a tool dpkg package called Maakit , but having trouble
>> >> >> running it - get this error on the master:
>> >> >>
>> >> >>  mk-table-sync -u sl2 -ppswd --print --sync-to-master --replicate
>> >> >> mailserver 192.168.1.11
>> >> >> DBI
>> >> >>
>> >> >> connect(';host=192.168.1.11;mysql_read_default_group=client','sl2',...)
>> >> >> failed: Access denied for user 'sl2'@'mybox.somedomain.com' (using
>> >> >> password: YES) at /usr/bin/mk-table-sync line 1284
>> >> >>
>> >> >> can anyone assist with the error ?
>> >> >> Or can someone tell me of a better opensource tool to use to sync
>> >> >> the
>> >> >> servers without a mysql dump ? my db is rather large.
>> >> >>
>> >> >> thanks
>> >> >>
>> >> >> --
>> >> >> MySQL General Mailing List
>> >> >> For list archives: http://lists.mysql.com/mysql
>> >> >> To unsubscribe:    http://lists.mysql.com/mysql
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Claudio
>> >>
>> >> --
>> >> MySQL General Mailing List
>> >> For list archives: http://lists.mysql.com/mysql
>> >> To unsubscribe:    http://lists.mysql.com/mysql
>> >>
>> >
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:    http://lists.mysql.com/mysql
>>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: multi master auto syncing when servers back on line

2012-06-06 Thread Andrew Moore
Joey, sounds like you've got a lot of testing to do before you can deploy
and support this in production yourself with out fear of shooting yourself
in the foot. Whilst you're trialling things, you could try 'XtraDB Cluster'
from percona.

A


On Wed, Jun 6, 2012 at 5:09 AM, Joey L  wrote:

> My current situation arises out of testing really - i restored a db
> that is out of sync with the other server (having less records) and
> then i tried to update the "master" server - and only seen the records
> that I updated and not the records that were additional to the other
> server when I first restored.
>
> I am just trying different scenerios before i put this in production.
> I was looking to do load balancing and i am concerned about
> high-availablitity.
> Is there a product that is opensource out there that I can use to
> maintian a master master setup with ease ?
>
>
> thanks
> mjh
>
> On Tue, Jun 5, 2012 at 6:18 PM, Andrew Moore  wrote:
> > Joey,
> >
> > The master master replication topology comes with it's own potential
> > pitfalls and trials. Be sure your use case needs master master and that
> > you're not implementing it because you think it's 'nice to have'.
> >
> > pt-table-sync should assist you getting your data in sync but how have
> you
> > arrived at this out-of-sync predicament you find yourself in?
> >
> > A
> >
> >
> >
> > On Tue, Jun 5, 2012 at 11:03 PM, Joey L  wrote:
> >>
> >> with all do respect - I am new to this - i did read the docs and
> >> having a hard time.
> >> I also was asking if you know something easier or does the trick as
> >> this utility does.
> >> thanks
> >>
> >> On Tue, Jun 5, 2012 at 5:06 PM, Claudio Nanni 
> >> wrote:
> >> > Joey,
> >> >
> >> > from what I can see from your email you lack of a lot of basics and I
> >> > suggest you to read some documentation before proceeding.
> >> >
> >> > Maatkit is now Percona Toolkit and contains some of the best tools for
> >> > MySQL.
> >> >
> >> > Cheers
> >> >
> >> > Claudio
> >> >
> >> > 2012/6/5 Joey L 
> >> >>
> >> >> Hi -
> >> >> I have setup mysql mult master setup on debian squeeze.
> >> >> I have realized that the databases have to be initially in sync
> before
> >> >> multi master can operate properly.
> >> >>
> >> >> This can require a lot of down time on the one functioning server.
> >> >> Is there a way to do an automatic sync from the 1 server that is
> still
> >> >> running ??
> >> >>
> >> >> I have found a tool dpkg package called Maakit , but having trouble
> >> >> running it - get this error on the master:
> >> >>
> >> >>  mk-table-sync -u sl2 -ppswd --print --sync-to-master --replicate
> >> >> mailserver 192.168.1.11
> >> >> DBI
> >> >>
> connect(';host=192.168.1.11;mysql_read_default_group=client','sl2',...)
> >> >> failed: Access denied for user 'sl2'@'mybox.somedomain.com' (using
> >> >> password: YES) at /usr/bin/mk-table-sync line 1284
> >> >>
> >> >> can anyone assist with the error ?
> >> >> Or can someone tell me of a better opensource tool to use to sync the
> >> >> servers without a mysql dump ? my db is rather large.
> >> >>
> >> >> thanks
> >> >>
> >> >> --
> >> >> MySQL General Mailing List
> >> >> For list archives: http://lists.mysql.com/mysql
> >> >> To unsubscribe:http://lists.mysql.com/mysql
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Claudio
> >>
> >> --
> >> MySQL General Mailing List
> >> For list archives: http://lists.mysql.com/mysql
> >> To unsubscribe:http://lists.mysql.com/mysql
> >>
> >
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:http://lists.mysql.com/mysql
>
>