MySql - Running a complex script using the .net Connector

| | Comments (0)
[The solution was discovered via this entry in the mysql.com forums]

I your MySql script contains code like

"/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"
You'll need to add "Allow User Variables=true" to your connection string. This can be achieved by manually adding it to the string, or, if using a MySqlConnectionStringBuilder, something similar to the following:

var builder = new MySqlConnectionStringBuilder
{
     Database = database,
     Server = Server,
     Password = Password,
     UserID = Username
};
builder.Add("Allow User Variables", true);
Make sure you're using at least version 5.2.6 of the MySql Connector/Net though! The forum posting states that it works with 5.2.2, but it didn't work with the copy of 5.2.2 I hav, but did with 5.2.6.

Other useful links from the forums:
Re: How do i run a *.sql script from my c# environment?

Leave a comment

About this Entry

This page contains a single entry by Rob published on June 2, 2009 8:30 AM.

A string of character 'x' the same length as string 'y' was the previous entry in this blog.

A review of "Review: CryptoLicensing for .NET" is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.23-en