Friday, 19 August 2011

BizTalk Server 2006 cannot access BizTalkMgmtDb database on SQL Server



Context:
The other day I tried to connect to a remote BizTalk Server group using my local BizTalk Administration Console.

Problem:
I was unable to do so even if I was a member of the BizTalk Administrators group of the remote installation. I was being displayed the following dialog box telling me that BizTalk Server 2006 cannot access database BizTalkMsgmtDb on SQL Server:




I checked each of the numbered points displayed in the dialog box to finally discover that I had the wrong version of BizTalk Server installed on my machine. Actually, I was trying to connect to a BizTalk Server 2006 R2 instance with a BizTalk Server 2006 (no R2) console.

More information on how to check your BizTalk version can be found here.

Solution:
I uninstalled my BizTalk Server 2006 and installed BizTalk 2006 R2 and this corrected my problem. I was able to connect to a remote BizTalk server with my local BizTalk Administration console.

Tuesday, 16 November 2010

[BizTalk] Automatically create folders configured for file adapters in BizTalk Applications

After installing and configuring a BizTalk application, we often MANUALLY create the folders configured for receive locations and send ports. This process is quite cumbersome if you have an a large number of folders to create.

While deploying a huge BizTalk application for one of my clients, I developed a small c# console application which accesses the BizTalk Management database to retrieve a list of configured folders and then creates these folders in the Windows local file system.

Here is the SQL script, I used to retrieve the list of FILE receive locations and send ports:

USE [BizTalkMgmtDb]
GO

-- Author: Shah MOHAMOD
-- Description: Retrieves the FILE receive locations and send ports information from the BizTalk management database

SELECT *
FROM
(
-- Get FILE receive locations
SELECT [dbo].[bts_application].[nvcName] AS ApplicationName, [Name], [InboundTransportURL] AS URI, 'Receive' AS LocationType
FROM [dbo].[adm_ReceiveLocation]
INNER JOIN [dbo].[bts_receiveport] ON [dbo].[adm_ReceiveLocation].[ReceivePortId] = [dbo].[bts_receiveport].[nID]
INNER JOIN [dbo].[bts_application] ON [dbo].[bts_receiveport].[nApplicationID] = [dbo].[bts_application].[nID]
WHERE [AdapterId] IN
(
SELECT [Id]
FROM [dbo].[adm_Adapter]
WHERE [Name] = 'FILE'
)
UNION ALL

-- Get FILE send ports
SELECT [dbo].[bts_application].[nvcName] AS ApplicationName, [dbo].[bts_sendport].[nvcName] AS [Name], [nvcAddress] AS URI, 'Send' AS LocationType
FROM [dbo].[bts_sendport_transport]
INNER JOIN [dbo].[bts_sendport] ON [dbo].[bts_sendport_transport].[nSendPortID] = [dbo].[bts_sendport].[nID]
INNER JOIN [dbo].[bts_application] ON [dbo].[bts_sendport].[nApplicationID] = [dbo].[bts_application].[nID]
WHERE
[dbo].[bts_sendport_transport].[nvcAddress] <> ''
AND [dbo].[bts_sendport_transport].[nTransportTypeId] = 3
) AS T
GROUP BY ApplicationName, [Name], [URI], [LocationType]
ORDER BY ApplicationName, [Name], [LocationType]

Then all that I had to do is to write is small c# console application which takes in 2 parameters:
1. The name of the SQL server instance which contains my BizTalk databases
2. The name of the BizTalk Management database (e..g. BizTalkMgmtDb)

In my program, I used the Directory.CreateDirectory(path) method which creates all directories (and sub directories) in the specified path.

So finally, the creation of my 165 file locations was done in just a few milliseconds. All I had to do, was to pass in the the correct parameters to my console application.

Enjoy,
Shah

Wednesday, 10 November 2010

[BizTalk Bindings Import] Misleading error message while importing a BizTalk application bindings on a newly installed BizTalk Server

While importing binding information in a BizTalk application on my NEW BizTalk Server, I got the following error message:

"The following items could not be matched up to hosts due to name and/or trust level mismatches:
Item: 'FILE' Host: 'BizTalkServerApplication' Trust level: 'Untrusted'
You must do one of the following:
1) Create hosts with these names and trust levels and try again
2) Re-export the MSI without the binding files and have a post import script apply a suitable binding file."

As indicated by the error information, I checked my host name and also made sure that my host was untrusted. The 2 parameters were correct nevertheless I could not import my bindings.

CAUSE:
I had newly installed my BizTalk server. I created my host and host instances but forgot to do the association between my hosts and the send and receive handlers of the different BizTalk adapters (File, HTTP, MSMQ, etc)

SOLUTION:
Before importing the bindings on my new BizTalk Server, I associated my BizTalk hosts to the appropriate BizTalk adapters. This is done via the BizTalk Administration Console by going into the Platform Settings\Adapters section.

Cheers.