Connect to Embedded MySQL

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

Connect to Embedded MySQL

Post by Alvin » Sun 29 May 2005 08:18

As I need to make a project with Embedded MySQL and I hope to use C# as the tools. Would any one tell me how can I make the Embedded MySQl ready for connection. Especially for MySQLDirect.NET, what should I do before use this component. Thank you very much.

Alvin

Serious

Post by Serious » Tue 31 May 2005 07:07

You can use any of our demo projects with embedded server.
Just set MySqlConnection.Embedded = true.
For more information see "Using Embedded Server" article in MySQLDirect .NET help.

Alvin

All I have tried

Post by Alvin » Wed 01 Jun 2005 16:28

I've recomplied libmysqld.dll without error. Placed the library in C:\window\system32. Placed my.ini in C:\window\. But it still not work in my codes.

my.ini:
[embedded]
basedir=C:/mysql/
datadir=C:/mysqlembedded/data/


Codes:
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 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();
}
}
}
}

Return-> Additional information: 在應用程式中有錯誤。 at connection open

I use MySQL 5.0 beta and Core Lab MySQLDirect.NET latest version.

Please help.

Alvin

Serious

Post by Serious » Thu 02 Jun 2005 09:23

MySQLDirect .NET has not tested yet with MySQL Embedded Server v5.0. Try to use MySQL Embedded Server v 4.1.

Post Reply