Deep end

The data warehouse is closed down this weekend, or rather the MySQL database of the data warehouse is shut down to simulate an IT crisis. I have received a shitload of alarms, my telephone’s audible alarm is ringing like mad. I hope Henrik knows what he is doing. When I did the same midsummer eve 2013, I was made to swear never ever do that again. And now Henrik deliberately do the same thing for training some new guys in the BI-team, I’m a bit apprehensive about this exercise. There will be a mess to sort out on Monday, I think one new guy have only been there for a day or two! The new guys are just thrown into the deep end. If the newbies survive they be data warehouse experts by the end of the week, which is pretty amazing. Let’s hope for the best.

Pandora's Box

Woe to the British people, woe to EU, woe to Europe and woe to rest of the world. The British people voted to leave EU. The people are not always right, last Thursday the British people were wrong.
To be a EU member or not to be, is simply to complicated for a referendum, it is not fair to the people to require an ‘exit’ or a  ‘remain’ from them. To call for such a referendum is to open the door for populists, the sweetest tongue, the loudest voice is likely to win, since no one can see the consequences of the Brexit, any lie will be as good as the truth.

Politics is not what I normally write about in this blog, but it’s my blog so I can write whatever I feel like.


I’m a C# .net developer yes I am

Most of the time a new computer language is simple to pick up, the logic and operations that is. The hard part these days is to understand the class structure and all accompanying frameworks and learn the IDE (visual studio in this case). Often there is not much logic behind these components which force you to learn a lot by heart, so when I say I’m a C# .net developer I mean I understand parts of the machinery you need to master if you are a true master C# .net developer. But I think I now have the basic skills, I just have to learn more and practise hard for a year or so to become a proficient C# .net developer.
So far I like C# .net and the development environment, I have a feeling you can be very productive knowing these tools.
Normally I display my code, but in this case I’m unsure if this is open or closed source and  what company policy dictates for closed source code, so I show this picture which tells where I am in the visual studio world.

The C# .net code I have written is substandard so it is nothing you want to look at anyway. But it works, you do not expect much more from a PoC so I'm happy.


Football and the Data Warehouse

Who wins 2016 European Championship?
With the help of The Data Warehouse and Qlikview the Business Intelligence crew have created an app for keeping track of the results and where you put your money or rather wine bottles. I will win some some +200 bottles of wine if I win this company EURO 2016 competition. Yes I know you can do the app with Qlikview only or Excel or …, but now the BI crew based in on the Data Warehouse for better transparency and integration with other viewers than Qlikview.   

My results for the group stage

Actually I do not know what I would do with +200 wine bottles, since I seldom drink wine these day. Anyway I suppose the BI crew will win since they are in control of the data or rather the match results from all competing in this game. That is what Data warehousing and Business Intelligence are about. Stay ahead of the competition by taking control of the data. Anyway it is a nice and practical example of making BI useful.

I blurred the picture since I do not want other contestants to see the winning results, that would delute my win.


PHP Linux calling MS SQL server via PDO

Many seem to have problems accessing MS SQLServer databases from Linux via PHP/PDO.
This is how I connect.

I use freeTDS to interface with PHP/PDO.

Setup freeTDS

First I I downloaded latest stable freetds release from http://www.freetds.org/software.html, which happened to be freetds-0.95.95 in my case.

Then the compile pirouette:
  1. ./configure --enable-msdblib --disable-debug --with-tdsver=8.0 --enable-msdblib
  2. make
  3. make install (as root)
This can be checked with tsql -C:

I tried to ./configure TDS version 8.0 which is MS SQL, but I got version 5.0 which is Sybase!
The configuration directory is /usr/local/etc, the configuration file is freetds.conf, (you find an example file in the directory), I added an entry for my MS SQL Server instance:

       port = 1433
       tds version=8.0
The server is called rdc01, port is MSSQL default 1433 and tds version=8.0.
I tested this with the tsql command:

[tooljn@toossedwvetl3 pgm]$ tsql -S rdc01 -U userid -P 'password' -L database
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> select 'hej'
2> go

(1 row affected)
1> exit

As you see I specify rdc01 as MS SQL server (rdc01 points back to the entry in the configuration file.
I run a select ‘hej’ (terminated by go on the next line) just to make sure the server responds, and it did with ‘hej (1 row affected)
And I ended the session with exit.
So far so good freeTDS is installed and working, now to PHP.

Compile PHP

The compile pirouette:
  1. ./configure
  2. make
  3. make install (as root)
I have a lot of ./configure parms for the PDO interface I use:
--with-pdo-mysql=shared \
--with-pdo-dblib=shared \
--with-pdo-odbc=shared,unixODBC,/usr \
--with-unixODBC=/usr \

I use the following PHP code to display  the PDO interfaces installed:

dblib is what we want.
Now we only have to do a pdo connect:
$pdoHandle = new PDO (dblib:host=rdc01;dbname=database, userid, password);

dblib:host=rdc01 points back to the configuration file.

And that’s it folks.