Does mySQLDirect.net support the "SHOW databases" command?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Micheal

Does mySQLDirect.net support the "SHOW databases" command?

Post by Micheal » Mon 28 Feb 2005 07:44

I uses mySQLDirect.net to try the embedded MySQL server. But when the following segment is executed:
CoreLab.MySql.MySqlConnect connect = new CoreLab.MySql.MySqlConnect();
connect.embdded = true;
String sql = "SHOW databases";
CoreLab.MySql.MySqlCommand command = new MySqlCommand(sql, connect);
CoreLab.MySql.DataReader reader = command.executeQuery();

the NotSupportedException rises. And when sql = "SHOW tables", the same exception occurs. The version of libmysqld.dll is 4.1.10. Who can tell me what is teh reason?

Thanks.

Correct

Post by Correct » Mon 28 Feb 2005 08:37

Sorry.
The statement
"CoreLab.MySql.DataReader reader = command.executeQuery();" is not correct. Its correct form is "CoreLba.MySql.DataReader reader = command.executeReader();"

Serious

Post by Serious » Mon 28 Feb 2005 11:22

Your code contains a lot of errors. Try this code.

Code: Select all

using System;
using CoreLab.MySql;

namespace Console2003_2
{
	class Class1
	{
    [STAThread]
    static void Main(string[] args)
    {
      MySqlConnection connection = new MySqlConnection("host=localhost;database=requests;user id=root;");
      MySqlCommand command = new MySqlCommand("show databases", connection);
      connection.Open();
      try
      {
        MySqlDataReader reader = command.ExecuteReader();
        try
        {
          while (reader.Read())
          {
            Console.WriteLine(reader.GetString(0));
          }
        }
        finally
        {
          reader.Close();
        }
      }
      catch (Exception ex)
      {
        Console.WriteLine(ex.Message);
      }
      finally
      {
        connection.Close();
      }
    }
	}
}
Check if your user has sufficient privileges to to execute SHOW DATABASES command.

Micheal

Post by Micheal » Tue 01 Mar 2005 07:27

Thank for the reply. The code segment you gave is not suitable for the embedded MySQL server.

Micheal

Post by Micheal » Tue 01 Mar 2005 07:38

Thank for the reply.
The code segment is:
using System;
using CoreLab.MySql;

namespace Console2003_2
{
class Class1
{
[STAThread]
static void Main(string[] args)
{

MySqlConnection connection = new MySqlConnection("host=localhost;database=requests;user id=root;embedded=true;");
MySqlCommand command = new MySqlCommand("SHOW tables",connection);
connection.Open();
try
{
MySqlDataReader reader = command.ExecuteReader();
try
{
while (reader.Read())
{
Console.WriteLine(reader.GetString(0));
}
}
finally
{
reader.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
connection.Close();
}
}
}
}
And NotSupportedException still rises.

Serious

Post by Serious » Tue 01 Mar 2005 12:40

There was an error in my previous topic. Correct connection string:host=localhost;database=requests;user id=root;embedded=true;
Possible problems with embedded server are described in "Using embedded server" article.
If after attentive reading of this article you still cannot work with embedded server, please write a letter to our tecnical support.

Micheal

Post by Micheal » Wed 02 Mar 2005 12:48

Thank for the reply.
The code segment is:

Code: Select all

using System;
using CoreLab.MySql;

namespace Console2003_2 {
  class Class1 {
    [STAThread]
    static void Main(string[] args) {

      MySqlConnection connection = new MySqlConnection("host=localhost;database=requests;user id=root;embedded=true;");
      MySqlCommand command = new MySqlCommand("SHOW tables", connection);
      connection.Open();
      String sql1 = "use mysql";
      MySqlCommand command = new MySqlCommand(sql1, connection);
      command1.executeNonQuery();
      try {
        MySqlDataReader reader = command.ExecuteReader();
        try {
          while (reader.Read()) {
            Console.WriteLine(reader.GetString(0));
          }
        }
        finally {
          reader.Close();
        }
      }
      catch (Exception ex) {
        Console.WriteLine(ex.Message);
      }
      finally {
        connection.Close();
      }
    }
  }
}
And NotSupportedException still rises at line:reader = command.ExecuteReader(). Since command1.executeNonQuery() can be executed successfully, the system configuration and distribution is correct. So I doubt that MySqlDirect.NET do not support the SHOW databases and SHOW tables.

Serious

Post by Serious » Wed 02 Mar 2005 13:28

Your code had an errors:

Code: Select all

MySqlCommand command = new MySqlCommand("SHOW tables", connection);
connection.Open();
String sql1 = "use mysql";
MySqlCommand command1 = new MySqlCommand(sql1, connection); // you used the same command name
Did you recompiled MySQL Embedded Server as described in "Using embedded server article"? If you have problems with it, send a mail to our tecnical support.

Micheal

Post by Micheal » Wed 02 Mar 2005 23:06

Thanks for the reply.
I had recompiled libmysqld.dll as told in "Using Embedded MySQL Server" article. There is not error in the following code:
MySqlCommand command = new MySqlCommand("SHOW tables", connection);
connection.Open();
String sql1 = "use mysql";
MySqlCommand command1 = new MySqlCommand(sql1, connection); // you used the same command name.
I have sent a email to your technical support, but there is not any reply still.

Serious

Post by Serious » Sat 05 Mar 2005 15:35

Did our letter help you? If you have questions about the files we have sent you, please put your questions to the forum.

Micheal

Post by Micheal » Tue 08 Mar 2005 01:14

Thanks for your help.

CoreLab.MySql.MySqlException rises at line using(MySqlDataReader reader = command.ExecuteReader()). I use the evaluation verion of MySQLDirect.net.

Post Reply