This has been a feature I have long waited for. Thank you!
Is there an example of a connection string using this feature?
I've tried everything and I'm still having errors when I call to OPEN the database.
Current code: (This is the code that works today pointing to a single MySQL server)
MySqlConnection DbConnection = new MySqlConnection();
DbConnection.Host = "server1";
DbConnection.Port = 3306;
DbConnection.UserId = "MNT";
DbConnection.Password = "MNT";
DbConnection.Compress = true;
DbConnection.Database = "MNT";
try
{
DbConnection.Open();
}
catch (OdbcException e)
{
How would I re-write it to point to server1 port 3306 (as PRIMARY) and server2 port 3306 (as SECONDARY) using the new Load Balancing support in version 8 professional?
Thank you so much for the help.
Load Balancing in MySQL - connection string
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Load Balancing in MySQL - connection string
For using load balancing you have to specify all servers with their ports in Host property. The following code will use the loadbal bancing feature:
For more information, please refer to http://forums.devart.com/viewtopic.php?t=28132
http://blogs.devart.com/dotconnect/orac ... ducts.html
Code: Select all
MySqlConnection DbConnection = new MySqlConnection();
DbConnection.Host = "server1:3306,server2:3306";
DbConnection.UserId = "MNT";
DbConnection.Password = "MNT";
DbConnection.Compress = true;
DbConnection.Database = "MNT";
try
{
DbConnection.Open();
}
...
http://blogs.devart.com/dotconnect/orac ... ducts.html
Re: Load Balancing in MySQL - connection string
Thank you! I've give that a try. In the dotConnect for MySQL 8.0 release statement, it shows a semi-colon between the addresses & ports combinations. I didn't know that it should have3 been a comma.
Thanks,
Thanks,
Re: Load Balancing in MySQL - connection string
to properly get this working...
This was the change I had to make:
... = "(server1:3306,server2:3306)";
This was the change I had to make:
... = "(server1:3306,server2:3306)";
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Load Balancing in MySQL - connection string
You are right. Servers and ports must be enclosed in parentheses.