Copy Azure SQL Database to local machine (SQL 2008 R2)

You would have thought in these days of point and click a simple task like copying a database from one place to another would be a walk in the park. So when I wanted to take a copy of a SQL database from Azure and move it to my local machine, I thought it surely would be straightforward. It’s not. Here’s what I came up with:

In Azure make sure you have a Storage account set up, with a container inside. My container is called ‘files’.

export1

In Azure go to your database. Click the Export button down the bottom.

export2

A new window will pop up. The file name will probably be pre-filled. Select your blob storage account (if you only have one then it’s already selected). Select a container (mine is ‘files’). Enter your SQL Server log in name and password – these are the credentials you set up when you added the database. Click OK and the export should start – you’ll see the status down the bottom.

export3

Once the export is done, you can click to view your Storage container, and you should see the export file there.

export4

The trick now is to get the file from Azure to your local machine. I use Azure Storage Explorer, it’s a free download. Download the file from your container.

export5

If you have SQL Server 2012, then you are home free, because you can import the BACPAC file in SQL Management Studio. Right click on the Databases folder under a server in the Object Explorer and choosing “Import Data-tier Application.

If like me you are on SQL Server 2008 R2, you need some help.

Create a new blank database on your local machine.

Go to  http://msdn.microsoft.com/en-us/jj650014 and install the SQL Server Data Tools for Visual Studio 2010. After install go and find SqlPackage.exe, I located it in C:\Program Files\Microsoft SQL Server\110\DAC\bin. Open up a DOS prompt and use the following command:

SqlPackage.exe /a:Import /sf:c:\Desktop\FILENAME.bacpac /tdn:DATABASENAME /tsn:SQLSERVERNAME
  • FILENAME.bapac is the file you downloaded from Azure, whereever it is located on your machine.
  • DATABASENAME is the name of the new blank database you created a minute ago.
  • SQLSERVERNAME is the name of the SQL server on your local machine.

I followed these steps, albeit for a fairly small file, and it worked perfectly.

And this is why the banking system in the USA sucks – $40 fees to transfer $150 between two accounts at the SAME BANK!

BofA

I’ve been following with interest stories in the media about the US banking system getting its act together and introducing Chip and PIN security for credit cards. A credit card transaction protected by a chip (embedded in the card) and PIN (a PIN as opposed to a signature) is a much much more secure payment, and far less open to fraud.

I read an article today headlined “American businesses are holding credit card security back“, which actually seems to be more about how the US banking system is holding it back – they are pushing for Chip and signature, a lower grade of security. I particularly thought this quote from the American Bankers Association was a good indicator of the banking sector’s resistance:

“You’ve got both banks and retailers struggling with how to find the right mixture of providing security to customers, yet also the convenience that American customers expect.”

Their argument is consumers don’t want another PIN to remember. What a load of tosh – for most people this is a furphy. I have a Visa card, that is also my EFTPOS card. It’s the same PIN. Nothing more to remember. And is anyone seriously suggesting that signing is faster than tapping in a four digit number?

We’ve had Chip and PIN in Australia for quite a while – along with contactless payments like Visa PayWave, where you just wave your card at the payment terminal for transactions under $100. Terrific technology that saves heaps of time.

Along with card security, it would be nice if the US banks sorted out the fundamentals. Take my experience this week. Someone in the USA owed me $150. Normally he would wire payments to my Australian account, but that costs him $35 for the transfer fee, which seemed silly for $150. The money was sitting in his Bank of America account, so I suggested he just transfer it to my Bank of America account. I never have much money in there, but it’s useful to have a few dollars lying around to cover Netflix and iTunes (for the US iTunes Store).

Here’s where the lunacy begins. My friend sends me the money. The bank charges him a transfer fee of… are you sitting down with a stiff drink in one hand … $US25. I then log into my account and, as you can see from the above screenshot, I’ve been charged a $15 wire transfer fee. A total charge of $40 to move money from one savings account to another WITHIN THE SAME BANK!

Patently ludicrous. If this was Australia, I could have logged into my National Australia Bank app, typed in someone else’s NAB account, and sent them the money, with no fees, and the money be immediately available to the receiving party (it takes a two or three days for Bank of America to make the cash available).

It’s no wonder that disruptive startups like Square, Stripe and others are tackling payments and banking in general. I’ve heard loads of excuses – oh, the inter-changes between the banks in the US are so much more complicated; or, there are multiple funds transfer exchanges; or, there are so many players in the market it’s difficult to gain cooperation and agreement. Whatever. But given the industry association that claims to lead policy for the US banking system itself seems resistant to introducing change, I suspect the main impediment is that more convenience for customers might lead to less price gouging opportunities for all the players with their snouts in the financial services trough.

Yet it seems to this unqualified economist that addressing fundamental structural weaknesses in an economy, such as the ease and free flow of payments, surely must be a driver for growth and expansion. Which then suggests the US banking system is happy to favour short-term profits over long term economic and social benefits. Now where have we seen that before? Oh yup –  when they buggered the home mortgage sector and kindly bestowed the GFC on us all.

Apple definitely taking selling iPhones in China seriously

image

I can tell Apple is taking the new opportunity of selling iPhones in China really seriously. This update just turned up on my iPhone, and I don’t even live in China. Presumably every iPhone5 user in the world has to install an update just so they can fix a provisioning problem with iPhones sold in China. ‘Provisioning’ is all about activating a new phone on to a phone network, so it looks like they’ve had some issues with Chinese customers unable to use their shiny new smartphones.

Puzzle for the day, why one particular Glyphicon Halflings icon is acting weird

calendar-icon

Today’s conundrum, why does one particular Glyphicon Halflings icon display differently between browsers? I have several other icons and they are all correctly displaying black and white. Yet this one icon – calendar – on the same page, same code, displays differently across my browsers.

On FireFox and Safari it displays in colour:

Screen Shot 2014-01-29 at 9.03.15 AM

On IE it displays in black and white:

Screen Shot 2014-01-29 at 9.04.37 AM

On Chrome it doesn’t display at all:

Screen Shot 2014-01-29 at 9.04.12 AM

The markup is straightforward:

Screen Shot 2014-01-29 at 9.11.55 AM

Finally tracked down this answer on Stackoverflow:

There is most likely an issue with inclusion of Glyphicons on BootstrapCDN 3.0.0 version. When 3.0 was released the glyphicons were in a separate repo, and then combined into the Bootstrap baseline again later around 3.0.1.

I updated the CSS CDN include from:

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">

to:

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">

and my calendar icon is now correctly displaying as black and white across all browsers.

Now Internet Explorer won’t even confess to being Internet Explorer

liar

The bizarre world of Internet Explorer never ceases to amaze me. Today’s revelation – Internet Explorer 11 doesn’t even like to admit that it’s Internet Explorer.

When a web browser visits a web site, it identifies itself to the web site with a string of information that contains various elements that say to the web site “hey, I’m here, this is the type of web browser I am, my version, operating system”. It’s known as the user-agent string.

In the past the user-agent string for Internet Explorer would look something like this:

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

The ‘MSIE’ stands for Microsoft Internet Explorer, so pretty easy to work out which browser is visiting your web site.

Today I was wondering why I could not teach some web site code to recognise it was being visited by IE, did a little research and came up with this page of explanation from Microsoft.

Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko

What’s missing? The ‘MSIE’ of course!

If I was using Firefox, the string would say FIREFOX, like this:

MOZILLA/5.0 (MACINTOSH; INTEL MAC OS X 10.8; RV:26.0) GECKO/20100101 FIREFOX/26.0

Safari would say ‘SAFARI’, and Chrome would, well now there’s the rub, because Chrome can say CHROME as well as SAFARI:

MOZILLA/5.0 (MACINTOSH; INTEL MAC OS X 10_8_5) APPLEWEBKIT/537.36 (KHTML, LIKE GECKO) CHROME/32.0.1700.77 SAFARI/537.36

Remind me again why I got into this web development malarky?

Rare bouquet for Telstra, selling unlocked iPhone 5

iphone5

It’s rare I pay a compliment to Telstra, they’ve been the source of so much pain over the years, and their domination of the telecommunications market in Australia is akin to Godzilla in a childcare centre, but for once I must give them kudos.

I upgraded my trusty iPhone4 to the new (and very very good) iPhone5s the other day. A key issue for me was unlocking the phone – removing the lock that carriers put on handsets to make sure you can only use the phone on their network. I need my phone to be unlocked so I can swap to my USA SIM card when I’m in America.

In the past unlocking a phone has even incurred a charge – from memory a jaw-aching $100 or $150. But nowadays it’s free – just go to the Unlock page on the Telstra web site. And here’s the massively good and useful news “All iPhone 5 models are already unlocked. “. Nothing for me to do!

It’s one in the eye for telcos in the USA, where they persist selling phones locked to the carrier, with complicated rules about when you can unlock – for example, usually you need to own the handset outright – eg not be paying it off as part of a phone plan contract.

Hackers with a sense of humour, or at least a love of Chinese food

Screen Shot 2014-01-16 at 3.51.46 PM

A client asked me to check into a page on their web site that captures name and address registrations from users. The page is available to the public, and does not included a CAPTCHA. The form entries are saved into a database table, there were many entries clearly submitted by a bot over a period of time. Many of them had the address “3137 Laguna Street, San Francisco”, which presumably was just a piece of junk, the main prize was them adding a bunch of links off to dodgy web sites in a description field.

Out of idle curiosity I Googled the address. It’s a Chinese restaurant!

I bet the Syrian Electronic Army never leaves restaurant recommendations on the sites they attack 🙂