BizTalk with Visual Studio - Steps to query SQL Server? - sql-server

Does anyone know of a source (article, blog, tutorial, video, ...anything) clearly describing the simplest / best practice steps required to build a BizTalk application (part) with VS being able to query a SQL Server Database table or view?
I already have a very simple but functioning BizTalk 2013 solution in Visual Studio 2012, and now I'm trying to integrate it with SQL Server 2012 the most simple way imaginable - i.e. trying to build up an orchestration with a receive port querying (either via polling or via query notification) a very simple SQL Server view.
Of course, I have read msdn articles, all of which just describing a tiny-little part of the whole process, never getting the whole picture throughout them.
Of course, I've also googled and searched stackoverflow around, never finding anything like that.
I'm still not sure whether you need 5 or 50 steps to achieve that (simple) goal.

This is what I could figure out. Unfortunately, this is quite a complicated process involving overall 12 steps.
You are welcome to show me a better / simpler / nicer solution, which I accept then instead of mines immediately. After all, this is why I'm here.
EDIT: + deploy + further details
Steps to query a SQL Server (2005 or above) database table / view in a BizTalk 2013 application developed in Visual Studio 2012 - the simplest / best practice approach:
Install the BizTalk Adapter Pack. Normally, it's not installed with BizTalk together, so you have to install it separately.
Ensure that the Service Broker is active in your SQL Server.
Ensure that your BizTalk application has the necessary permissions to request notification in your SQL Server database. See: Enabling Query Notifications.
In your BizTalk project in Visual Studio, generate a WCF-SQL BizTalk adapter notification schema via the Add Adapter Metadata Wizard and configure it as described here: Processing Notification Messages to Perform Specific Tasks. For the notification, you are only allowed to query a table - even if you need the result set of a view. In that case, query (one of) the underlying table(s) here.
Add a notification message of the just generated notification schema to your just generated orchestration.
Add a receive port of the just generated port type and a receive shape to the orchestration to receive the notification messages. And there you have your SQL notification message in your orchestration.
Generate a WCF-SQL BizTalk adapter select schema via the Add Adapter Metadata Wizard similarly as in step 4. Don't choose any existing adapter in this step, and don't configure any binding - just take the URI you created in step 4 with another inbound ID. Select the view / table you want to query and the select operation from the available ones.
Add a select query and a select response message of the just generated respective schemes to the orchestration.
Add a send-receive port of the respective send and receive shapes to the orchestration to send out the select query messages and receive the result messages back. And there you have your SQL query result in your orchestration. Process it as you like.
Build and deploy your BizTalk project in Visual Studio.
Configure your just deployed BizTalk application via BizTalk Server Administration. As a first step, add the WCF-SQL adapter to the list of adapters in your BizTalk Server. It's a good idea to export your binding configuration here, once you have fought your way through it, so that you can later import it back if you loose it e.g. because of a new deployment.
Start the application.
And there you have your running BizTalk application querying a SQL Server database table / view.

Related

SQL-Server: send ONE mail from more SQL-Servers on different Win Servers

I have different SQL-Servers installed on different Windows Servers. Each SQL-Server have a maintenance plan and now I am adding the e-mail function. That means I get e-mails from every SQL-Server. But I want just ONE e-mail, if that´s possible.
Is there a way to configure e-mail over all SQL-Servers to get only one?
As far as I'm aware this isn't possible in SQL Server out of the box.
You'll either need an external application to do this, or maybe make some script that can run on one SQL Agent that checks the state of jobs on all the servers. Of course if the server that ran on failed, you'd get no notification.
I'd go with an external powershell script, a good example can be found on SQL Server Central.

Quickly changing SSIS-packages data source parameters for easy migration

I would need to migrate a SQL database from Sybase to MS SQL Server. Before doing the actual migration on the production server I first created an SSIS-package with SQL Server Management Studio's Import/Export Wizard for testing with other databases. The test migration was successful and I would now like to deploy my SSIS-package to the real servers.
However, it seems I cannot simply run the package in Management Studio choosing different data sources for it - it only runs on the same databases for which it was created. Now, it can be edited in something called SQL Server Business Intelligence Development Studio (or BIDS for short)(I am using the SQL Server 2008 version), but going through every data flow task changing the destination source manually for each of the ~ 150 tables I am moving is ineffective and also introduces a possibility for error.
I there a way to quickly change what data source is to be used for ALL destination sources in ALL the flow tasks of an SSIS-package? If not, what simple method is there for testing migration with test databases first and simply changing the data sources when deploying?
I am using ODBC data sources, but for some the package shows OLE-sources in BIDS instead.
I hope I was clear enough. If you have additional questions, please ask! Thank you!
I would use a variable for the ConnectionString property of the connection manager. A package level configuration can be very useful for accomplishing this task. Several ways to do this. I prefer to use a table in SQL Server that holds all the configurations for all packages. This can be especially effective if you have multiple packages and need to dynamically change a set of connection managers across those multiple packages.
The basic steps are:
Opposite click on your SSIS design surface and select "Package Configurations..."
Create a package level configuration of Configuration Type "SQL Server"
Store your connection in a Configuration table in SQL Server
Alter your Connection Manager to use a variable for the ConnectionString Property
Populate that variable from the Configuration table via your package level configuration
When it comes time to switch from Test to Production, simply update the connection string in your configuration table
These screenshots can help...
This is part of a larger package management framework that I implemented using this book:
Microsoft SQL Server 2008 Integration Services: Problem, Design, Solution
I highly recommend it. Should take less than a day to set it up. Book has step by step instructions.
This question and its associated answers also helpful.

Drupal 7 webform submission to remote MSSQL server

When users fill up a form on my Drupal 7 site, I need that information to go into a remote MS SQL server db. It's essentially a reservation system, so they fill up details like date/time and name, and when they click submit, these fields need to be pushed into a remote MS SQL db.
I'd like to know a) if this is possible and b) how do I go about implementing this?
A. Yes it is possible.
B. I recommend the below way, which is also the "Drupal" way of doing it.
Establish a connection to the remote database. Have a look here if you want to do it in your code, or have a look here if you want Drupal to take care of it by configuring settings.php. The key to switching between databases are db_set_active($database).
Run the queries you'd like to run against the MSSQL database. Just remember to put switch between the databases using db_set_active().
You can create a custom form in Drupal easily using its Form API in a custom module. In the submit handler for your form, you can insert the submitted data to your MS SQL database using any library avaiable in your PHP environment. Connection to the database is the tricky part, especially if your Drupal host is not running a Microsoft OS. In Drupal 7 running on IIS, you can use Drupal's Database API with the MS SQL driver. If your are not on IIS or Drupal 7, this is also doable without Drupal's Database API using PDO ODBC with unixODBC and FreeTDS. I did it, but I had a major issue when using typed bound parameters in my query, see Using typed bound parameters with PHP PDO-ODBC, unixODBC and FreeTDS.
That said, integration of applications at the database level is a bad idea. Such integration is tightly coupled. Any change to the schema of your MS SQL database or they way actual data are stored in columns will break your form submission. The best would be to have your reservation system provides a remote API to insert new data.

Sending a merge request through TFS 2008

I am wondering if TFS 2008 is capable of sending an automatic notification to a developer when a merge request for a specific bug, change request, etc is made?
Any suggestions?
Thanks,
nino11
TFS Power Tools is the most detailed you can be with project alerts.
You cannot however send a notification when simply the request was made. You can however send a notification as soon as a merge takes place (IE after it completes). You can use the "Check in to specific folder" type of project alert.
I would install TFS Power Tools and take a look at all the features it has. If its not there- you can't do it- at least not to my knowledge in TFS 2008.

Database trigger that communicates with an external program

I've got a SQLServer Database and an application (.NET) that configures data on that database. On the other hand, I've got an application (VC++) that reads that data from the database and must be 'informed' a soon as possible of any change in the data saved on the database.
I would like to receive a signal from the database engine when some data had been changed by the first app. Of course, I can code some kind of message that comunicates both apps but my question is if exists that mechanism (some kind of ultra-trigger that warns the other app) in SQLServer or in any API for accessing SQLServer (Native, OLE DB, or even ODBC)
PS: Apologize for my english
If your requirements include guaranteed delivery (e.g. no lost events) - you might want to consider an MSMQ based strategy.
Accessing MSMQ from Microsoft SQL Server
http://www.codeproject.com/KB/database/SqlMSMQ.aspx
Microsoft Support Knowledge Base Article: 555070
Posting Message to MSMQ from SQL Server
http://support.microsoft.com/kb/555070
You can use a SQL Agent Job that will notify the other app starting it with sp_start_job. Check this out.

Resources