Connect to Embedded MySQL

Connect to Embedded MySQL

Postby 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
Alvin
 

Postby 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.
Serious
 

All I have tried

Postby 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
Alvin
 

Postby 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.
Serious
 


Return to dotConnect for MySQL