dbdesc blog

database documentation

Dbdesc and Dtsdoc Review at ASP Alliance

AspAlliance.comRichard Dudley has published a full review of my database documentation tool, dbdesc, and the SQL Server DTS documenter, dtsdoc. Here is the article abstract:

“I am a fan of simple tools which work well and save me a lot of time. Two of my “new best friends” are Logica2’s sister programs dtsdoc, which documents SQL Server DTS packages, and dbdesc, which documents SQL Server schemas. The documentation is complete and generated quickly, and both programs have found a lasting place in my SQL Server toolkit.”

The article is a very good introduction to both products. Thanks Richard for the positive comments.

How to Reduce the Size of Your MSI Installer

I use WiX to build the installer packages for dbdesc and dtsdoc. Today, I’ve reduced the size of both installers by 20%. How?

It turns out that the WiX tutorial states it clearly:

We also have to include the icon we want to use in the shortcuts. Note that the Id identifier has to carry the same extension as the target file, in this case, .exe: <icon Id=”Foobar10.exe” SourceFile=”FoobarAppl10.exe” /> This will store the source file separately in the final installation package (so, if you refer to your main executable, you will end up with two copies). If the size of the file is large enough to cause concern, create a small .exe or .ico containing nothing but the icons.

(Emphasis mine)

Of course, I was extracting the icon directly from my executable. That is 550 KB for dbdesc and 280 KB for dtsdoc. In fact, it was much worse, because I had an additional reference to the executable for a second icon. The net result is that I was adding one additional megabyte to the dbdesc installer and about 500 KB to dtsdoc.

So, remember to reference directly an icon instead of your executable and you will save bandwidth and download time.

Dbdesc 2.2 Ready

I’ve just uploaded a new version of dbdesc. This version adds some useful features that I’m sure many of you will love.

The first one addresses a common scenario: Your database has hundreds of tables, views and stored procedures. You need to provide the database documentation to someone (a developer team, a client, etc.) but she only needs to know about part of your database. So you manually select and deselect individual objects and generate the documentation. So far so good.Save object selection

The problem here is that chances are that you’ll need to generate that documentation for her in the future, what means that you’ll need to select and deselect those same objects again. Not fun.

Dbdesc 2.2 allows you to save object selections, as many as you need. To save the current selection, just give it a name. Saved selections show up right in the advanced form.

Another main new feature, that I hope will improve in upcoming versions, it’s the ability to customize the internal report. As you know, dbdesc has two report engines. One of them is based on XSL templates which allow you to fully control the contents, design and format of the documentation. The other one is a third-party report component which generates nice reports ready to be printed.

Until now, using the report component, you could choose only between three different style sheets to change the appearance of the report and they were limited, basically, to change font colors. Now, dbdesc includes a style sheet editor that will allow you to modify not only the colors of the report but to change the cover page, include you company logo, change the headers and footers, modify fonts, etc. Hopefully this will help you match the style of these reports to your corporate look and feel.

This version includes more features and improvements that you can check in the change log.

As always, I’ll appreciate any comments or suggestions. Please send me your comments.

Advanced Code Visualization Add-in for Visual Studio

My friend Jon has released a new exciting product for C, C++ and C# Visual Studio developers. It’s called codekana and it enhances the Visual Studio experience boosting your productivity.

I’ve been using a beta version of codekana for several weeks and once you have used it for just some hours you just can’t go on without it. The color-coded flow control, the graphical outlines and the smart highlighting adds another level of ‘quick understanding’ to your code. But don’t take my word on this; just try it out for a couple of days or so and then press Ctrl-Shift-Alt-K to deactivate codekana. It’s a weird sensation. Press Ctrl-Shift-Alt-K to bring life to your code again.

This add-in could look as a nice-to-have one until you try it, then, it becomes a must-have.

By the way, it’s only $39 for limited time!

Problem Dropping a User in SQL 2005

Today I’ve encountered a problem trying to drop a user from a database. I kept getting this error:

Msg. 15138 The database principal owns a database role and cannot be dropped

So it looked like the user owned a database schema. To find out the schemas that a user owns I’ve used this query:

SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE schema_owner = ‘UserName’

UserName was the owner of the dbo_owner schema, so to return the schema to the original owner I’ve executed this other query:

ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo

Then I’ve been able to drop the user without problems.

ExecutionEngineException Nightmare

Last week, a potential customer of dtsdoc reported a new error. It was an ExecutionEngineException. Let me tell you that this is one of the worse exceptions you can get from a .NET application.

To begin with, this exception cannot be catched, which means you don’t get a nice call stack or any other useful info to track down the problem.

If you dig in MSDN you will find this explanation: “The exception that is thrown when there is an internal error in the execution engine of the common language runtime.”, not very helpful.

Finally if you google about it, you’ll find lots of exasperated people looking for answers but almost no solutions at all. One thing that seems to share all those posts is that they are trying to do some kind of interop with COM objects.

To make a long story short, it was a bug in the Microsoft DTS libraries that dtsdoc uses to inspect and document DTS packages. The bug is fixed in SQL Server 2000 Service Pack 4, so updating those libraries solved the problem.

So, if you run into some RuntimeExecutionException, check your unmanaged libraries first, chances are that any of those libraries has a bug.

Vi Power for Die-hard Windows Users

I’ve been enjoying the vi input model since Jon released the first version of ViEmu for Visual Studio and, just like he warned me, at first it was a bit difficult to change my typing habits. However, soon I began to appreciate the vi way of doing things and I started to take advantage of its power and speed. I probably only use 30% of its commands but I’m a lot more productive than before and what is more important, I enjoy typing!

Now, he has just released ViEmu for Microsoft Word and ViEmu for Microsoft Outlook! There’s only one word: AMAZING!

Congratulations!

Dbdesc 2.1 Available

A new version of dbdesc is now available. This version improves a lot the successful extended property editor that was introduced in version 2.0. A special ‘thank you’ to all of you who have sent me feedback and suggestions, and specially to Tom Pester who has dedicated a lot of effort in helping me polish this version up.

As I mentioned earlier, the bulk of improvements are in the extended properties editor. Now you can add descriptions to most SQL Server objects like stored procedure/UDF parameters, user-defined types, assemblies, etc. The usability has been improved too; now your changes are committed to the database in real-time and it’s a lot easier to navigate through the editor.

SQL Server extended properties editor

Close to the title of each main group of objects there’s a percentage indicating how many objects are annotated; very useful if your goal is to annotate every object. You can also hide the objects that already have descriptions and leave only those without comments.

You can see the full change log in the download page.

Firebird 2.0 Is Finally Out

FirebirdThis week, the Firebird project has finally released version 2.0 final.

Although this version comes with lots of improvements and changes, I think that dbdesc should be able to document 2.0 databases without problems. I will try to find time this very weekend to test it.

Here are the release notes and download page.

UPDATE: Even though you can connect with a Firebird 2.0 server to document a database, using the local (embedded) connection does not work because it needs the new fbembed.dll version. I’ve uploaded a maintenance release (2.0.1) to address this issue. Installer size has grown a little (~1 MB) because of the updated Firebird libraries.

Dealing With Spam

Steph, founder of LandLordMax Property Management Software, has posted a very descriptive post about the problems of dealing with email spam.

I just can not imagine receiving thousands of spam emails every single day. I’m not even close to that amount of emails. I used to receive less than one hundred per day (fingers crossed!).

To deal with them, I use SpamAssassin. It is setup to tag and redirect emails to a special account. Periodically, my email client downloads those emails to a SPAM folder and I inspect those tagged emails once a day. The inspection is pretty straightforward as most of the times the subject line is enough to decide if it is spam or not.

This system is working for me, but again, I receive a moderate amount of email each day.