Browsing:

Month: May 2014

I use Ubuntu as a development workstation (but it doesn’t matter!)

I use Ubuntu as my development machine and I like to evangelize about it. But actually it doesn't matter at all. It's the functionality I run that is the most important. And since that is the case, the underlying OS becomes irrelevant. That's why I tend to choose the OS with the smallest footprint. Which would be a Linux based OS.

So here is why, and how, I use Ubuntu.

2014-05-24_10-42-50

This picture is Ubuntu running in Parallels, which looks great in high res on the MacBook Pro Retina screen.

Some Linux advantages over another OS

There are some advantages of running Ubuntu (or another Linux distro):

  • system requirements are low, you can happily use older hardware
  • the software is open source and free (as in 'costs nothing', although I donate to my favourite open source projects like LibreOffice and Ubuntu itself).
  • installation is easy, however installing Windows is easy too.
  • installation is fast because Ubuntu has a smaller footprint than Windows (8 GB vs 20 GB, and then Ubuntu is considered large in comparison with e.g. Puppy Linux)
  • installation of software is a delight, because of the packaging method (apt, yum, rpm, pacman and so forth). With a package manager you do not need to browse to websites to grab a copy
  • Updating is just as simple apt-get update && apt-get upgrade
  • If you prefer to work with the keyboard and in the terminal, Linux is your best fried. Just choose your terminal, your favourite shell, your favourite editor and your good to do any kind of task

So how do I use Ubuntu?

  • I am a keyboard user. Ubuntu is very friendly for keyboard users! Especially the Dash is very handy:
  • As IDE I use Subtext and Vim. In Vim I us the NERDTree. Vim deserves a dedicated post. It's an extremely versatile editor that lives in the terminal and it is very small (6 MB). It has a steep learning curve. But when you get the hang of it you'll notice how powerful it is. And Vim is ubiquitous. It's everywhere (as Vi on every Linux machine). Once you know vi, you can deal with every Linux machine out there.
    vim
  • I use Robomongo to browse Mongo databases.
  • The Gimp is a great Photoshop replacement, especially now that you can enable single Windows!
    gimp
  • Chrome is my mainbrowser. I use the apps a lot so I have access to them on every machine.
    chrome
  • Last but not least: I use XMind for mindmapping. It is multiplatform. And I love it. It too deserves a dedicated post.

    xmind

So I use Ubuntu

And yes, I can do all above mentioned things on my Mac and Windows machine as well, but going the Ubuntu way the footprint is the smallest.

    
    
    


Creating a linked server ´MySQL to MSSQL´(query the MySQL database without openquery function)

In addition to my previous linked server tutorials, I decided it is time to add MySQL to the linked server series.
In order to have the bug tracking application, Mantis migrated from linux and have it run on a windows environment, I wanted to create a replication between SQL2008 and MySQL, but then I thought, why not try out a virtual linked server again first, to test Mantis isntallation on a Windows based installation, since the online promise of Mantis on a MSSQl environment is not very promising. So today we will create a linked server from MySQl to MSSQL on a windows 2008R 64 bit environment.

Create DNS for MySQL

In order to do so, We first need to install the correct drivers in order to create a ODBC DSN, Just download the drivers from Mysql developers site http://dev.mysql.com/downloads/connector/odbc/ and install them to your database server. DriversIf we see the listed drivers, it means we can create a new DSN, so open up the System DSN tab and ADD a new DSN, you must fill in the correct credentials, for example:ODBC_Connector

Data Source Name: Enter a describing name, so you can see what it does, you might have more linked servers or other connectors running on the same server.
Description: this isnt maditory, but if you want to be more specific, be my guest.
Server: in my case,it's localhost, as this is a test server and MSSQL and MySQl are on the same server.
Insert username and password, when this is done. The database will display the possible databases you can connect to, in the dropdown.

Click OK and as you can see the System DSN has been added to ODBC.

Create new Linked Server

When this is done, it's time to open up the MSSQl server and add a new linked server to the Server Objects.4_create_LInkedsname your linked server, I give it the same name as the SystemDSN. And choose the correct provider: Microsoft OLE DB Provider for ODBC Drivers. and datasource equels DSN name.
You need to fill in all the credentials for the provider string, for example:

DRIVER=(MySQL ODBC 5.2 ANSI Driver);SERVER=localhost;PORT=3306;DATABASE=mantisbt; USER=user;PASSWORD=password;OPTION=3;

Note: meaning of OPTION=3 in the MySQL connection string:
Option=1 FLAG_FIELD_LENGHT: Do not Optimize Column Width
Option=2 FLAG_FOUND_ROWS: Return matching rows
Option=3 option 1 and 2 together

Now click OK, this is always the most fun part to me! when it says connection tot the linked server succeeded!

In addition to this, you can enable provider options on the SQLOLEDB, In my case I select the Dynamic Parameter and Allow inprocess.

Now, lets run the test and see if it connects with the databases, as you can see, it connects all the databases available on the MySQL server.

Connection test

But, most important, we can query it directly. Wheeee!

Linked server without OpenQuery function (Tip!)

Maybe you have read other MySQL linked server tutorials before this one and found out that you could only query the mysql database using the openquery() function or maybe that IS  the reason it brought you to this site. Extra, as in extra work, is never fun! With the correct ODBC driver and the right provider options, you can query the MySQl database, just like any other MSSQL database on your MSSQL server. Just follow the tutorial above and don't forget to  enable the correct provider options. Cheers!