- Posted by reggie on May 12, 2008
Hi,
MySQL Connector/Net 5.1.6 a new version of the all-managed .NET driver for MySQL has been released. This is a minor release involving mainly bug fixes.
Version 5.1.6 works with all versions of MySQL including MySQL-4.1, MySQL-5.0, MySQL-5.1 beta or the MySQL-6.0 Falcon "Preview".
It is now available in source and binary form from [http://dev.mysql.com/downloads/connector/net/5.1.html] and mirror sites (note that not all mirror sites may be up to date at this point of time - if you can't find this version on some mirror, please try again later or choose another download site.)
Bugs fixed
- Fixed problem where parameters lists were not showing when you tried to alter a routine in server explorer. (bug #34359)
- Fixed a problem in procedure cache where it was possible to get into a race condition and cause a memory leak (bug #34338)
- Fixed problem where attempting to use an isolation level other than the default with a transaction scope would use the default instead (bug #34448)
- Fixed problem that causes the TableAdapter wizard to only generate insert statements. The problem was that our code to retrieve index columns was broken. (bug #31338)
- Fixed problem with connections staying open after being used with SqlDataSource. The problem was that we were not returning an enumerator for our reader with the closeReader option set to true when we were supposed to. (Bug #34460)
- Fixed problem where the bit data type would continue to return null values once it saw a null value in a previous row (bug #36313)
- Fixed problem with MembershipUser.GetPassword where attempting to retrieve a password on a user where password Q&A is not required would throw an exception (bug #36159)
- Fixed a problem with MembershipUser.GetNumberOfUsersOnline. It actually works now :) (bug #36157)
- Fixed documentation that still stated that setting port to -1 was necessary for a named pipe connection (bug #35356)
- Fixed data type processing so that geometry fields are returned as binary. (bug #36081)
- Fixed problem that kept our provider from showing up in the provider list when configuring a new connection from a SqlDataSource
- Fixed problem where setting the ConnectionString property of MySqlConnection to null would throw an exception (bug #35619)
Enjoy and thanks for the support!
- Posted by reggie on April 25, 2008
So Boot Camp 2.1 came out yesterday. This release has official Vista x64 support but the trackpad issues (no two finger right click, erratic two finger scrolling) have not been fixed. This is starting to smell bad and it has Steve Jobs' name all over it.
- Posted by reggie on April 17, 2008
MySQL Connector/Net 5.0.9, a new version of the all-managed .NET driver for MySQL has been released. This release is an update to the existing production-quality 5.0 series.
We plan for this to be the last release in the 5.0 series. We will only be updating the 5.0 product in the event a "data-loss" type bug is discovered. We encourage all new products to use the new 5.1 product.
Version 5.0.9 works with all versions of MySQL including MySQL-4.1, MySQL-5.0, MySQL-5.1 beta or the MySQL-6.0 Alpha.
It is now available in source and binary form from here and mirror sites (note that not all mirror sites may be up to date at this point of time - if you can't find this version on some mirror, please try again later or choose another download site.)
Features or behavior changes
- added implementation of MySqlCommandBuilder methods QuoteIdentifier and UnquoteIdentifier (bug #35492)
Bugs fixed
Fixed problem where fields that were blobs but did not include the BLOB flag were treated as binary when they should have been treated as text. (Bug #30233)
Changed from using Array.Copy to Buffer.BlockCopy in MySqlDataReader.GetBytes. This helps with memory usage as we expect the source and destination arrays to not be overlapping. (Bug #31090) Fixed problem that prevented commands from being executed from the state change handler. Not sure why you would want to do this but... (bug #30964) Fixed issue where column name metadata was not using the charset given on the connection string (Bug #31185) Fixed problem with installer where the installation might report a failure to remove the performance counters if the performance counter category had already been removed for some reason Fixed problem with installer where attempting to install over a failed uninstall could leave multiple clients registered in machine.config. (Bug #31731) Fixed problem with connection string caching where our collection class was using case insensitive semantics and this causes cases where a user originally used the wrong case for a user id and then fixed it to still get access denied errors. (Bug #31433) improved the speed of load data local infile significantly fixed MySqlDateTime.ToString() to properly return the date value (Bug #32010) fixed problem where string parameters who have their size set after their value could cause exceptions (Bug #32094) fixed problem where old code was preventing creating parameter objects with non-input direction using just a constructor (Bug #32093) fixed problem where a syntax error in a set of batch statements could leave the data adapter in a state that appears hung (bug #31930) fixed the MySqlException class to set the server error code in the Data[] hash so that DbProviderFactory users can access the server error code (Bug #27436) fixed problem where changing the connection string of a connection to one that changes the parameter marker after the connection had been assigned to a command but before the connection is opened can cause parameters to not be found (bug #13991) some fixes to cancel and timeout operations so that they are more dependable fixed problem where cloning a parameter that has not yet had its type set would yield a cloned parameter that would no longer infer it's type from the value set
- Posted by reggie on April 14, 2008
I was so looking forward to hanging out in Santa Clara this week with all the fine people that come to see my .NET and Windows presentations (yes, both of you!) at the annual MySQL Users Conference. The problem is that I hurt my knee Saturday evening and now I can barely walk. So I decided it was better for me to stay home and try to stay off the knee as much as I can. Sorry for those people who were planning on attending my building and debugging on Windows session however the entity framework session should still happen with the ever-capable David Sceppa at the helm.
So go have fun while I sit here and wince. :(
- Posted by reggie on April 8, 2008
Recently I've read lots of forum posts from frustrated users claiming that their is something wrong with the Connector/Net installer. They reference the connector in their web app, then deploy the app to their remote host only to find that the app no longer works. I'll walk through a simple web app sample and show where the confusion comes from and what they should be doing instead. This sample assumes you have a recent build of Connector/Net installed with Visual Studio integration enabled.
First, we'll create a web app using Visual Studio 2008.
The next thing that many developers do is create some type of page that references the connector. Often this is a SqlDataSource that they will be connecting to a datagrid. To do that you drop a SqlDataSource control and a GridView control on the page. After setting the grid view to use the sql data source you now need to configure the data source control. Normally to do that you would select 'Configure Data Source...' from the smart tasks popup and walk through adding a data connection to your app (as well as Server Explorer). Due to a bug in our implementation currently you need to add the connection to Server Explorer first and then pick that connection in the Configure Data Source dialog. Once done with this you can find the new connection string in your web.config and see how the data source control is tied to it. Here is the connection string added to my web.config.
<connectionStrings>
<add name="testConnectionString"
connectionString="server=localhost;user id=root;database=test"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
Here is how my SqlDataSource is configured now.
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:testConnectionString %>"
ProviderName="<%$ ConnectionStrings:testConnectionString.ProviderName %>"
SelectCommand="select * from t1"></asp:SqlDataSource>
At this point you can hit F5 in VS and the web app will run and show you the data you specified in your query. However, if you deploy this application to a remote server that does not have Connector/Net installed then it will fail and you may see something like this:
What's going on? The first thing to understand is how the SqlDataSource connects to a data provider. If you refer back to our connection string you'll see the attribute providerName have the value 'MySql.Data.MySqlClient'. That is the invariant name of Connector/Net. However this name is not enough to locate the right assembly to load. This mapping is done in either the machine.config or web.config files. The Connector/Net installer makes the proper registrations in the machine.config file. Here is the DbProviderFactories section from my machine.config (I've omitted all entries but Connector/Net for brevity).
<system.data>
<DbProviderFactories>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,
Version=5.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
With this entry in machine.config then the system can match the invariant name to a fully qualified assembly name and also identify the client factory class that should be used. You can see that by examining the type attribute above.
So what do you do if you are deploying this app to a remote server that you can't install Connector/Net on? Simple. Add this registration to your web.config. Just drop it in right outside the system.web block like this:
<system.data>
<DbProviderFactories>
<clear/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,
Version=5.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
So why the <clear/> tag? You can't doubly add provider factories to the config system so if you have Connector/Net installed on your dev system and you register the provider factory in your web.config then you will be doubly adding them. The clear tag clears out all the provider factories pulled in from machine.config and then adds in yours. Now if you are mixing providers then you'll need to adjust this to your situation.
I hope this blog post has cleared up some of the reasons why people have working web apps on their dev systems but then are confused when it doesn't work after deploy.
- Posted by reggie on March 27, 2008
Finally got around to hacking in Slide.Show as my photo viewer. Yup, you need Silverlight installed to see them but with the way that Silverlight is growing that shouldn't be a problem.
Go check it out and let me know what you think!
- Posted by reggie on March 14, 2008
When we last left our hero he had just got the global data menu working under '05 and '08. Next step was use of the table browser. Here's a shot of it working with SQL Server data. Now there is no particular reason to use this data browser instead of writing our own other than it's just less work and it has a nice look and feel.
On the surface this looks pretty easy. After a little digging I discovered that this command binding will add a "Show Table Data" menu option and bring up a nice OleDB-based data browser under VS 2005.
<CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384"
handler="Microsoft.VisualStudio.DataTools.DBPackage.VDT_OLEDB_CommandHandler_TableTools">
<Parameter value="Open"/>
</CommandBinding>
The problem, of course, is that this doesn't work under VS 2008. The handler under VS 2008 is implemented by an object with the guid of 884DD964-5327-461f-9F06-6484DD540F8F. My first approach was to define two of these bindings and no matter which version of VS ran one of them would fail (and not add any menu item) while the other would succeed. VS doesn't like that. Apparently the guid and cmdId together form a key and you get a key added twice error. Hmmm
My good buddy Stephen at Microsoft offered up the solution of overriding the GetDataViews method of DataViewSupport and tweaking the XML that is returned. It turns out that he was spot on. I set all the handlers in the XML file to be proper for VS 2005, changed my DataViewSupport derived class to now use the no parameter constructor base, and then overrode the GetDataViews method like so.
public override Stream GetDataViews()
{
string xmlName = "MySql.Data.VisualStudio.DDEX.MySqlDataViewSupport.xml";
Assembly executingAssembly = Assembly.GetExecutingAssembly();
Stream stream = executingAssembly.GetManifestResourceStream(xmlName);
StreamReader reader = new StreamReader(stream);
string xml = reader.ReadToEnd();
reader.Close();
// if we are running under VS 2008 then we need to switch out a couple
// of command handlers
DTE dte = Package.GetGlobalService(typeof(DTE)) as DTE;
if (dte.Version.StartsWith("9"))
xml = xml.Replace
("Microsoft.VisualStudio.DataTools.DBPackage.VDT_OLEDB_CommandHandler_TableTools",
"884DD964-5327-461f-9F06-6484DD540F8F");
MemoryStream ms = new MemoryStream(xml.Length);
StreamWriter writer = new StreamWriter(ms);
writer.Write(xml);
writer.Flush();
ms.Position = 0;
return ms;
}
I won't bother with showing you a pic of it working in MySQL because it looks just like the other pic. But, then again, that's the point. :)
- Posted by reggie on March 14, 2008
It's no secret that that SQL Server integrates better into Visual Studio than any other database. We are trying to change that. Two of the things that I wanted to implement in the new version of our integration code is to replicate the Add New submenu and use the the built-in table browsers that Sql Server uses. Here is a screen shot of the global data menu we wanted to reproduce.

This menu should also work in Visual Studio 2005 though the top four items (Schema Compare, Data Compare, Refactor, and T-SQL Editor) won't be there. The problem is that adding items to the global data menu is not directly supported in Visual Studio 2005 but it is supported in 2008. This is further complicated due to the fact that Microsoft moved from using CTC files to VSCT files to define package resources. I didn't want to ship two binaries (one for 2005 and one for 2008) so I have continued to use the CTC format. Here is what I had to do to get it working.
First, I defined a constant for the appropriate menu group in VS 2005. I put this in my file named guids.h
#define guidVS2005Data { 0x501822e5, 0xb5af, 0x11d0, { 0xb4, 0xdc, 0x00, 0xa0, 0xc9, 0x15, 0x06, 0xef } }
Then I defined two menus and two groups (one for 2005 and one for 2008).
MENUS_BEGIN
guidMySqlProviderCmdSet:menuAddNew2005, guidVS2005Data:8706, 0x1000,, "MySQLAdd", "&Add New";
guidMySqlProviderCmdSet:menuAddNew2008, guidVSData:IDG_DV_GLOBAL1, 0x1000,, "MySQLAdd", "&Add New";
MENUS_END
NEWGROUPS_BEGIN
guidMySqlProviderCmdSet:groupAddNew2005, guidMySqlProviderCmdSet:menuAddNew2005, 0x0000;
guidMySqlProviderCmdSet:groupAddNew2008, guidMySqlProviderCmdSet:menuAddNew2008, 0x0000;
NEWGROUPS_END
Note here that 8706 is the id of the global data menu in VS 2005 and IDG_DV_GLOBAL1 is the id under VS 2008. menuAddNew2005, menuAddNew2008, groupAddNew2005, and groupAddNew2008 are just simple ids I assigned. The reason you need to define the menu twice is because no matter which version of VS you use it will balk at adding the same menu to two different top level groups.
Then I define the commands I want to appear on the menus but I don't put them on the menus here since I need to put them on two different menus.
/* global data menu items */
guidMySqlProviderCmdSet:cmdidAddNewTableGlobal, Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "&Table";
guidMySqlProviderCmdSet:cmdidAddNewViewGlobal, Group_Undefined:0, 0x0001, OI_NOID, BUTTON, DIS_DEF, "Vie&w";
guidMySqlProviderCmdSet:cmdidAddNewProcedureGlobal, Group_Undefined:0, 0x0002, OI_NOID, BUTTON, DIS_DEF, "Stored &Procedure";
guidMySqlProviderCmdSet:cmdidAddNewFunctionGlobal, Group_Undefined:0, 0x0003, OI_NOID, BUTTON, DIS_DEF, "Stored &Function";
guidMySqlProviderCmdSet:cmdidAddNewUDFGlobal, Group_Undefined:0, 0x0004, OI_NOID, BUTTON, DIS_DEF, "&UDF";
Now I add the commands to both menus
guidMySqlProviderCmdSet:cmdidAddNewTableGlobal, guidMySqlProviderCmdSet:groupAddNew2005, 1;
guidMySqlProviderCmdSet:cmdidAddNewTableGlobal, guidMySqlProviderCmdSet:groupAddNew2008, 1;
/* others omitted for brevity */
Now we need to add our commands to our data view XML file. Here is what one command binding looks like.
<CommandBinding name="AddNewTable" guid="B87CB51F-8A01-4c5e-BF3E-5D0565D5397D"
cmdid="500" handler="MySql.Data.VisualStudio.MySqlDataViewCommandHandler">
<Parameter value="HighLevel"/>
</CommandBinding>
Notice the command parameter named "HighLevel". This is important because without it the menus will not function correctly in VS 2005. You also need to add all the commands into the command bindings of every node. Yes, this is very repetitious but is necessary due to a bug in VS 2005. Without doing that the menu will appear when the connection node is selected but will disappear when on the other nodes.
I would also like to thank a developer at Microsoft who answered tons of my questions and helped me sort this out. His name is Stephen Provine and I really appreciate all his hard work. With all this done, here is the same shot working with MySQL.

- Posted by reggie on March 13, 2008
It's about 5pm and I'm sitting watching my son play in his second tennis match and working on my Mac. Boy I have to get used to saying that. This is a beautiful machine. After I used Boot Camp to install Windows Server 2008 x64 I started searching Google for driver locations and tricks to get everything working. After the default install I had the built-in NIC, wireless NIC (Broadcom), iSight, and audio not working. The blogs that talked about installing the Aetheros wireless driver obviously would not work since this is a new Mac and they've started using Broadcom. I even found a post giving a download link to some HP driver that was supposed to work. Frustrated, I decided to simply insert my Leopard disk and see what would happen. I had heard that x64 drivers had shipped with the new Mac Pros but not with the MacBook Pros so when I ran the installer I expected a polite error message. Instead, something really cool happened. All of my devices (except the Bluetooth hub) just started working. Yup. Every driver installed cleanly. No unsigned driver warnings. Nothing but cool clean workiness. Yes, that's a made up word.
Since this is Windows Server 2008 I can't run the tool that gives me an experience index but from reading other blog posts I would imagine it is around 5.3-5.5. Very fast I can tell you that. I can also tell you without a doubt that Windows Server 2008 *is* faster than Vista. If you are running Vista and don't have crazy application compatibility issues then do yourself a favor and try out Win2k8. There are lots of posts out there talking about all the steps you need to do to make it look and act like Vista.
So, I've installed Visual Studio 2005 and now I'm installing Visual Studio 2008. No wireless here at the tennis courts and I don't have Live Writer installed so I'm typing this blog post into visual notepad. :0
Oh, one other nice bit of coolness. I installed the demo of VMWare Fusion and used it to boot my boot camp partition. First, it was nice to see that Fusion has experimental support for Windows Server 2008. That makes sense since it is basically Vista. In any case, I was certain that once I booted under Fusion that all my drivers would be replaced with generic SVGA, mouse, etc drivers and that I would have to endure a re-discovery of hardware when I booted natively into Window. I was prepared for that actually. But no, my boot camp partition boots nicely under Fusion but also boots natively with all the optimized drivers still in place. Call me naive but I didn't expect that. Very, very nice. By default the vm only had 512 meg assigned and that's like trying to carry the Brady Bunch in a Yugo. So I'll have more to say about Fusion and Unity once I get back to Mac land and give the vm a more appropriate 1.5 gig. I'm sure I'll be shopping for a 2 gig ram upgrade soon enough.
- Posted by reggie on March 12, 2008
The power connector broke on my old laptop and with several trips coming up I really needed to get some new iron. So the question is which one. I originally looked at a nice Sony Vaio and then I saw one of those nice Dell XPS m1330 machines. They have a very sweet LED screen and a nice form factor but I really wanted a larger screen. The problem is that the m1530 doesn't yet ship with Penryn processors or a LED screen. The other option was the MacBook Pro. Yes, I know...
So, after a lot of consideration, I chose to go with the Mac. Pretty easy decision actually. The Dell configures up with 3 year warranty at $1800 and the Mac at $2200. Now if you consider the upgrade costs for when the 1530 will support Penryn processors and an LED screen (the 1330 costs $200 more with these options), that puts the Dell at about $2000. The difference of $200 is a small amount when you consider that the Mac is the only laptop that can run all 3 major systems today. Yep, pretty easy decision.
So, the new Mac arrived today and I'm writing this blog entry on it. I plan to write for the next 30 days on my experiences on the machine. I'v always worked on Windows machines so it's a brave new world for me. I'll be testing out Parallels and VMWare fusion for my development work and playing with such gems as iMovie and iDVD around the house.
I had several good impressions during the first hour or so of us. Initial startup had a nice touch where it let me use the web cam to take a personal picture for the login screen. Anyway, I have lots more to talk about but I'll save it for the next entry.