0

I have a piece of C# code that I am compiling in MonoDevelop under Ubuntu 11.10. I have referenced MySql for Mono (using MySql.Data.MySqlClient;) and it works nicely if I try the same code under Windows. I had to rename the mysql.data.dll file to MySql.Data.dll for making it work in Linux though.

When I try to open the Mysql connection, I get this stacktrace on the Ubuntu box from within MonoDevelop:

  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.Driver.Open () [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000] in <filename unknown>:0

My executing code looks like this where _dbConn is a MySqlConnection:

            string connectionString = String.Format("Server={0};Database={1};User ID={2};Password={3};Pooling=false", 
                DbLocation, DbData, DbUser, DbPassw);

            _dbConn = new MySqlConnection(connectionString);
            //On the Open, I get the error
            _dbConn.Open();

Anyone ever seen this issue and/or have any idea how to work around it? Note: I am using the latest version of MySql .Net Connector for Mono.

2
  • What does the exception message for the stack trace say? Commented Apr 16, 2012 at 13:04
  • @RolfBjarneKvinge It says: "MySql.Data.MySql.Client.MySqlException has been thrown. Unable to connect to any of the specified MySQL hosts." I have no problem connecting via MySql using the terminal. I have double checked my string values and they are identical to what I use and see in the terminal (well, other than 'localhost' which I don't specify there). Commented Apr 16, 2012 at 13:18

1 Answer 1

3

Solved it myself. Turns out Mono was not up to date on this machine. Failed to see it since the badgerport repository was not added. Upgrading to the latest version solved the issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.