Tuesday, June 19, 2012

Using WPFToolkit.Extended in a MEF component

I'm developing a MEF component that utilizes WPFToolkit.Extended when I kept getting the following error:

{"Could not load file or assembly 'WPFToolkit.Extended, PublicKeyToken=3e4669d2f30244f4' or one of its dependencies. The system cannot find the file specified."}.

I'm looking in the Extensions folder and seeing it.  Ok, maybe Prism (one dependency) is missing.  Now to the fusion log. 
It lists the all the locations it looks for the DLL (probing paths), I notice that the extension path is not in there.  And thus lies the problem. 
You can place it in any of the probing paths from what I've seen (depending on order) but I personally chose to put it in /PrivateAssemblies for the time being. 
I'll fix when I deploy my VSIX for public consumption, but for the time being had to manually copy. 

Monday, June 18, 2012

MS SQL 2008 to MySQL 5.x Using Migration Toolkit

I have just been through hell.  A few facts

1.  I have no experience with MySQL except for once 10 years ago. 
2.  It's been a long time since I've used Java.
3.  Drupal doesn't play very well with MSSQL 2008 on upgrades. http://drupal.org/node/1567380

#3 was the killer.  My friends website (http://culturestab.com) was attempting to be upgraded and I could not get it to work correctly.  It looks like few have.  So, I decided to move to the more native platform MySQL.  I figured this should be somewhat easy.  It has not.  This is my tale.

My goal was simple.  Move from MSSQL -> MySQL and retain data.  Should be a tool right?  There are a couple. 

1.  Pay ones, they work, but a bit pricey.
2.  MySQL Migration Toolkit.  Retired.  But still "works".  Except with MSSQL 2008.  Given retired status, you can't find help.  When I would try to do a migration, I had problems that just kept showing up.  Hopefully this helps you get past it.


1.  The tool looks for a specific version of JDK/JRE.  A known bug, but the work around is to download the JRE (v7 is fine) and manually set it via the command line.  When said and done, your execution should look like this.

...\MySQL\MySQL Tools for 5.0>mysqlmigrationtool -verbose -jvm "c:\program files (x86)\Java\jre7\bin\client\jvm.dll

That covers our first issue.  Now we can actually start it.  Next.  JDBC hell.

First you need the latest JDBC drivers provided my Microsoft.  Download them here

Next, you need to configure the migration tool to use this driver.  Here's where it becomes a huge pain in the ass. 

1.  copy from the install directory the file sqljdbc4.jar to the lib directory under MySQL Tools (../java/lib)
2.  Edit the lua file for mssql (../lua/RdbmsInfoMssql.lua)
3.  Find the method function getDriverMssqlJdbc(owner)
4.  Comment out the line
  --  grtV.insert(driver.files, "jtds-1.2.jar")
5.  Add the line
     grtV.insert(driver.files, "sqljdbc4.jar")
5.  Replace
     driver.className= "net.sourceforge.jtds.jdbc.Driver"
      driver.className = "com.microsoft.sqlserver.jdbc.SQLServerDriver"

Finally:  Modify the connection string template to the following. 

driver.connectionStringTemplate= "jdbc:sqlserver://%host%\%instanceName%:%port%;database=%database%;user=%username%;password=%password%" ..

After this, I was able to connect and migrate fomr SQL 2008 -> MySQL.  Hopefully this saves someone else some time and a hell of a lot of money. 

Go baby go!