Archive for January 2012

Using GetPackagesInfos2

Recently I was creating the Advanced Execute Package task for Task Factory. One of the ways to retrieve a list of packages from SSIS is by using the GetPackageInfos method. However, the problem with GetPackageInfos is that it requires you to pass in a username and password. With the use of an OLEDB or ADO SSIS connection manager, this isn’t possible. You can grab the username from the SSIS connection manager connection string but you cannot retrieve the password. In comes GetPackageInfos2 which is an undocumented (of course it is!) way of retrieving packages from the MSDB server. The function signature for GetPackageInfos2 is:

Public Function GetPackageInfos2 ( _
	strFolder As String, _
	connectionObject As Object _
) As PackageInfos

Notice the second parameter is an Object type? Yeah, uh… good luck finding out what it is on your own. Fortunately I figured it out and was able to use it in my project… and so that you can just read this blog and not waste a few hours looking for an answer.

Turns out the connectionObject parameter is looking for an SSIS connection manager object. So to get the GetPackageInfos2 to work you simply grab a reference to a connection manager and pass the connection manager object into the function. mConnections is an a Microsoft.SqlServer.Dts.Runtime.Connections object.

Dim app As New Microsoft.SqlServer.Dts.Runtime.Application
Dim cm As Microsoft.SqlServer.Dts.Runtime.ConnectionManager = mConnections("MyConnectionManager")
' pass in the root folder of "/"
Dim packages As Microsoft.SqlServer.Dts.Runtime.PackageInfos = app.GetPackageInfos2("/", cm)

For Each package as PackageInfo in packages
     Console.Writeline(package.Name)
Next

So it’s as simple as that. Grab the connection manager reference from an OLEDB or ADO.NET connection managers, pass it into GetPackageInfos2 and you got your reference.

Leave a comment if you have any questions.

GoDaddy… Come on man!

If you’ve inexplicitely ever sat through an episode of ESPN’s NFL round table discussion shows you’re probably aware of the “Come on man” segments. If not, the basis is the commentators see an NFL player, owner, fans, ref, etc do something stupid and they call them out on their stupidity. It’s pretty funny sometimes, other times… not so much. Today I have my own come on man.

Come on Godaddy.com!

This particular feature of Godaddy.com has been bugging the hell out of me lately. I’ll go and search on their home page for a domain to see if it’s available. Instead of automatically removing http or www they decided to be lazy and let you fix issues with your query rather than trying to adjust it themselves. Here’s an example.

I went to godaddy’s home page and entered in www.rocksthoughts.com in the textbox for “Search for a domain”.

 

When I pressed the “GO” button this was the error message I received on the next page:

So basically they are saying “Hey, we know what you did but we’re too lazy to fix it”. Seriously… It’s not that hard to either REMOVE the www. or use a regular expression to look for it.

In fact, here’s some code for ONLY looking at the domain.

I mean a very easy way to solve that is:

Dim url As String = UrlTextbox.Text
 
If url.StartsWith("www.") Then
    url = url.Replace("www.", "") 
End If

 

I’m just not sure why that error exists. Am I missing something or are the Godaddy engineers being lazy here?

Book chapters complete

My Book

I was lucky enough to be invited to write some chapters for the upcoming Professional SQL Server Integration services book. This was a very unique experience unlike anything I’ve ever done before. I’ve never had someone really judge my writing skills (or lack thereof) before. So to have someone judge almost every sentence I wrote was very weird. I’m sort of glad that I can get away with writing code that doesn’t have to be judged line by line (well, except code reviews). That said, I had fun doing it and now I get to put that on my resume. Having a book published by Wrox is a pretty significant career and resume booster.

My chapters in the book cover the programming side of SSIS in terms of writing custom components. In essence they will be the chapters that most BI developers skip right over but programmers will read. Not many BI Developers I know are all that interested in writing custom components. They prefer to write script tasks and components to do what they need. I have to agree with them for the most part but the problem with script tasks and components is the lack of re-usability. If they need to use the same code base again they basically have to copy and paste it over and over again. Which sucks. So my chapters cover the pain staking task of creating custom components that can be used in any ssis package they create without copy and paste. Yes, it is quite a pain to create them. I do it every day writing Task Factory.

While I liked the experience of writing this book it’s one of those things you have to try to see if you like it for yourself. It was never fun having the Technical Editor remind me that I forgot essential parts of SSIS in 2012 and having to go spend hours / days learning new undocumented classes. Anyone who’s ever had to cry their way through writing code with undocumented Microsoft classes knows the pain I was in.

Was it worth it? Absolutely! While I won’t be spending time in France having Gertrude Stein review my work, I’m pretty proud of this accomplishment. I do, however, look forward to spending time in a local starbucks. Maybe at some point, when I visit Charleston, with my buddy Patrick Riddle.

 

Hello World!

When you install a wordpress blog the first post is always “Hello world!”. I’ve probably put together 50 websites in the past few years with wordpress and always delete the “Hello world” post. Because for the most part it’s not relevant to the site’s content. But this time I’m leaving it. It’s truly, Hello world for me. Well, really, hello world again…

A few years ago I had a pretty nice blog going on RocksThoughts.com. I had lots of code examples and generally a lot of good information about writing software. But as is often the case, (A.D.D. anyone?) I forgot about the blog and moved on to other projects. I was getting quite a few hits to the site and looking back I could have┬ámonetized┬áthe site for a nice monthly recurring income. The reason I didn’t do it then is because I didn’t know what I didn’t know. I was writing about cool stuff I found. I’m hoping to the same now.

SQUIRREL!!! (A.D.D. again). Seriously I walked away from writing this post for 45 minutes. I’d take a drug to control it but I hate prescription drugs. Anyways…

The one area I struggled with last time was writing about coding. I love coding but it’s only 20% of my life. Why should I write a full blog on 20% of my life. So this new blog will be about coding, websites, seo, sem, homebrew, family stuff, vacations, etc.

I’m not really writing for a specific audience and I doubt too many people will read this but I don’t really care all that much. It’s a place where I can write what I want (within reason) and have fun with it.

At this point if you’re still reading, that’s awesome. Congrats to you and hope you stick around for more.