[Mono-list] Looking for advice on accessing MySQL database
Luciano _
lnc19 at hotmail.com
Mon Nov 3 09:49:45 EST 2008
I guess that is "VM" problem, i had the same issue with VirtualBox, maybe: from your Windows Linux box you can't connect to MySql on Linux Box, in the other side you can? i read about it, it was VM issue (all the VM's programs) beacause the Network adapter is created on "user space" and not in "Kernel" space (mode) or something like this. In your other box you have something like 10.0.0.x and in the guest you have 10.0.1.x.I guess this is the problem, try ping this IP and see if you get any success on the response.
Lucian0
> Date: Mon, 3 Nov 2008 06:41:35 -0800> From: louis at traglobal.com> To: mono-list at lists.ximian.com> Subject: Re: [Mono-list] Looking for advice on accessing MySQL database> > > I changed my connection string from "Data Source" to "Server" as Luciano> suggested but that has not fixed the problem. Here is a code sample that> works in Windows but not Mono 2.0.1 for me:> > using System.Data;> using MySql.Data.MySqlClient;> > Code inside of a method:> > string connectionString = "Database=mysql;Server=10.0.1.106;User> ID=user;Password=password;" +> "Pooling=false;Connection Timeout=10;";> DataTable myTable = new DataTable();> using (MySqlConnection myConnection= new> MySqlConnection(connectionString))> {> Console.WriteLine("Opening MySql database connection....");> myConnection.Open();> Console.WriteLine("Connection Opened.");> using (MySqlCommand myCommand = new MySqlCommand("SELECT *> FROM user",myConnection))> {> using (MySqlDataAdapter myAdapter = new> MySqlDataAdapter(myCommand))> {> try> {> myAdapter.Fill(myTable);> }> catch(Exception ex)> {> Console.WriteLine("An exception occurred while> filling the datatable: " + ex.Message);> Console.WriteLine(ex.InnerException);> }> }> }> > }> if (myTable.Rows.Count > 0)> {> Console.WriteLine("There are " +> myTable.Rows.Count.ToString() + " rows in the mysql.user table");> }> > > When MyConnection.Open() is executed I get the following exception:> > Unhandled Exception: MySql.Data.MySqlClient.MySqlException: Unable to> connect to any of the specified MySQL hosts. ---> System.Exception:> Exception of type 'System.Exception' was thrown.> at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] > --- End of inner exception stack trace ---> at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] > at MySql.Data.MySqlClient.Driver.Create> (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] > at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000]> > > -- > View this message in context: http://www.nabble.com/Looking-for-advice-on-accessing-MySQL-database-tp20255843p20303964.html> Sent from the Mono - General mailing list archive at Nabble.com.> > _______________________________________________> Mono-list maillist - Mono-list at lists.ximian.com> http://lists.ximian.com/mailman/listinfo/mono-list
_________________________________________________________________
Get more from your digital life. Find out how.
http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home2_082008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20081103/e5fe42ff/attachment-0001.html
More information about the Mono-list
mailing list