Does mySQLDirect.net support the "SHOW databases" command?
Does mySQLDirect.net support the "SHOW databases" command?
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.
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.
Your code contains a lot of errors. Try this code.Check if your user has sufficient privileges to to execute SHOW DATABASES command.
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();
}
}
}
}
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.
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.
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.
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.
Thank for the reply.
The code segment is:
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.
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();
}
}
}
}
Your code had an errors: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.
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
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.
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.