Showing posts with label notification. Show all posts
Showing posts with label notification. Show all posts

Wednesday, March 28, 2012

new to notifications services and want example of setting up email notifications

I am new to SQL 2005 and want to setup a notification service to email me when a job fails. How do I begin to set that up? Any basic examples I can check out?

This forum is dedicate to SQL Server Notification Services; you'll probably have more luck getting responses in the SQL Server Tools forum (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=84&SiteID=1) or the microsoft.public.sqlserver.server newsgroup.

HTH...

sql

new to notifications services and want example of setting up email notifications

I am new to SQL 2005 and want to setup a notification service to email me when a job fails. How do I begin to set that up? Any basic examples I can check out?

This forum is dedicate to SQL Server Notification Services; you'll probably have more luck getting responses in the SQL Server Tools forum (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=84&SiteID=1) or the microsoft.public.sqlserver.server newsgroup.

HTH...

Monday, March 26, 2012

New SQL-NS 2005 Book

Folks,

I want to let everyone know that the 2005 update to my Notification Services book is now available for order. You can get it from http://www.amazon.com/gp/product/0672327791/.

This book has been completely updated for the 2005 release:

- All source code examples are now designed to work with the 2005 programming model and tools

- New chapters have been added to cover the new 2005 features (such as the NMO API, Hostable Execution Engine, and User-Defined Matching Logic)

I hope you find this useful. As always, I appreciate receiving any feedback you may have.

Thanks

-shyam

Hi Shyam,

I bought your book, and it's really good book which can tell me more detail.

Right now I met a problem when I was testing SMTP delivery channel in chapter 10. with local smtp service, the musicStore worked as expected, but if I changed to use another computer in the same domain, nothing happened. Checking the application event view, it said:

Notification Class Name: NewSong

Notification Status Info: The e-mail address or SMTP server value is not valid.

SMTP Server: 192.168.1.128

Message Recipients: emily@.work.com

I have tried other setting for SMTPServer in InstanceConfiguration.xml, like "\\myServer", "myServer.myDomain" and "myServer.myDomain.local", but all got the same result. I have checked online book and some forum, but nothing helpful. Could you help it out? Thanks in advance.

Regards,

Chris

|||

HI shyam,

Just got the book this week and im finding it very useful and helpful. The std MSDN examples are very short on documentation. I dont seem to have one issue though, Im currently going through chapter 6 and am finding that the scheduled subscriptions for the Music Store sample are not working.

Working through the database i can see that my NewSongByGenreSubscriptionProcessingTimes table is not being filled in. I looked a little deeper into the SQl statements and ran this

SELECT subscriptions.SubscriptionId, subscriptions.Created
FROM [SongAlerts].[NewSongByGenre] subscriptions

This unfortunately returns nothing, which looks to be the problem as my chronicle always stays empty. I've used your tool to add the scheduled subscriptions and unfortunately that does seem to work, its adding subscriptions, so i cant understand why the query above doesnt fire.

A little deeper and i see the two tables NSCurrentNewSongByGenreSubscriptions and NSFiringNewSongByGenreInterval are empty? dont really know what they do.

Dont suppose you can test and confirm that Chapter 6 does work correctly. I've been over it 3 times and am about to get a work mate to try on their machine, but so far no luck.

Aside from that little niggle, its an excellent book, the chapter on Custom Delivery Channels was worth it alone. :)

|||

For those who consider buying this book to prepare for their new project on SQL Server Notification Services, here's what I have to say:

1. I bought the author's previous book (on SQL NS 2.0 - for SQL Server 2000). Before I got it, I had only a very dim idea about what NS is and what it can do.

2. Two weeks later, I had a fully functional prototype of my application. It had only a subset of the real huge project's functionality (the project is truly HUGE!..), including a custom content formatter and a custom event provider. But it worked, and we are now just extending it. I mean, no need to refactor the code or start from scratch. Well, to tell you the truth, in those 2 weeks I worked quite a bit more than 8 hours a day, but it was worth it. My boss is still trying to throw some tricky questions on me (like, "What happens with our application IF..."), and there have been no questions so far that I was unable to answer. The book is just great!

3. My advice to you: work through all the samples (at least, in the first half of the book, or until you get a clear idea on how all the pieces of NS fit together). It's not nearly as bad as it sounds: the explanations and step-by-step instructions on how to do every little thing are so good that even a complete moron would be able to get it (and none of us are morons... I think... ;-)

4. I usually buy technical books only when I need to get up to speed with a particular technology as fast as possible. Shyam Pather's book exceeded all my expectations. The book reads as easily as my favorite science fiction books (and way easier than "The Lord of the Rings"). And almost as interesting as they are.

New SQL-NS 2005 Book

Folks,

I want to let everyone know that the 2005 update to my Notification Services book is now available for order. You can get it from http://www.amazon.com/gp/product/0672327791/.

This book has been completely updated for the 2005 release:

- All source code examples are now designed to work with the 2005 programming model and tools

- New chapters have been added to cover the new 2005 features (such as the NMO API, Hostable Execution Engine, and User-Defined Matching Logic)

I hope you find this useful. As always, I appreciate receiving any feedback you may have.

Thanks

-shyam

Hi Shyam,

I bought your book, and it's really good book which can tell me more detail.

Right now I met a problem when I was testing SMTP delivery channel in chapter 10. with local smtp service, the musicStore worked as expected, but if I changed to use another computer in the same domain, nothing happened. Checking the application event view, it said:

Notification Class Name: NewSong

Notification Status Info: The e-mail address or SMTP server value is not valid.

SMTP Server: 192.168.1.128

Message Recipients: emily@.work.com

I have tried other setting for SMTPServer in InstanceConfiguration.xml, like "\\myServer", "myServer.myDomain" and "myServer.myDomain.local", but all got the same result. I have checked online book and some forum, but nothing helpful. Could you help it out? Thanks in advance.

Regards,

Chris

|||

HI shyam,

Just got the book this week and im finding it very useful and helpful. The std MSDN examples are very short on documentation. I dont seem to have one issue though, Im currently going through chapter 6 and am finding that the scheduled subscriptions for the Music Store sample are not working.

Working through the database i can see that my NewSongByGenreSubscriptionProcessingTimes table is not being filled in. I looked a little deeper into the SQl statements and ran this

SELECT subscriptions.SubscriptionId, subscriptions.Created
FROM [SongAlerts].[NewSongByGenre] subscriptions

This unfortunately returns nothing, which looks to be the problem as my chronicle always stays empty. I've used your tool to add the scheduled subscriptions and unfortunately that does seem to work, its adding subscriptions, so i cant understand why the query above doesnt fire.

A little deeper and i see the two tables NSCurrentNewSongByGenreSubscriptions and NSFiringNewSongByGenreInterval are empty? dont really know what they do.

Dont suppose you can test and confirm that Chapter 6 does work correctly. I've been over it 3 times and am about to get a work mate to try on their machine, but so far no luck.

Aside from that little niggle, its an excellent book, the chapter on Custom Delivery Channels was worth it alone. :)

|||

For those who consider buying this book to prepare for their new project on SQL Server Notification Services, here's what I have to say:

1. I bought the author's previous book (on SQL NS 2.0 - for SQL Server 2000). Before I got it, I had only a very dim idea about what NS is and what it can do.

2. Two weeks later, I had a fully functional prototype of my application. It had only a subset of the real huge project's functionality (the project is truly HUGE!..), including a custom content formatter and a custom event provider. But it worked, and we are now just extending it. I mean, no need to refactor the code or start from scratch. Well, to tell you the truth, in those 2 weeks I worked quite a bit more than 8 hours a day, but it was worth it. My boss is still trying to throw some tricky questions on me (like, "What happens with our application IF..."), and there have been no questions so far that I was unable to answer. The book is just great!

3. My advice to you: work through all the samples (at least, in the first half of the book, or until you get a clear idea on how all the pieces of NS fit together). It's not nearly as bad as it sounds: the explanations and step-by-step instructions on how to do every little thing are so good that even a complete moron would be able to get it (and none of us are morons... I think... ;-)

4. I usually buy technical books only when I need to get up to speed with a particular technology as fast as possible. Shyam Pather's book exceeded all my expectations. The book reads as easily as my favorite science fiction books (and way easier than "The Lord of the Rings"). And almost as interesting as they are.

New SQL-NS 2005 Book

Folks,

I want to let everyone know that the 2005 update to my Notification Services book is now available for order. You can get it from http://www.amazon.com/gp/product/0672327791/.

This book has been completely updated for the 2005 release:

- All source code examples are now designed to work with the 2005 programming model and tools

- New chapters have been added to cover the new 2005 features (such as the NMO API, Hostable Execution Engine, and User-Defined Matching Logic)

I hope you find this useful. As always, I appreciate receiving any feedback you may have.

Thanks

-shyam

Hi Shyam,

I bought your book, and it's really good book which can tell me more detail.

Right now I met a problem when I was testing SMTP delivery channel in chapter 10. with local smtp service, the musicStore worked as expected, but if I changed to use another computer in the same domain, nothing happened. Checking the application event view, it said:

Notification Class Name: NewSong

Notification Status Info: The e-mail address or SMTP server value is not valid.

SMTP Server: 192.168.1.128

Message Recipients: emily@.work.com

I have tried other setting for SMTPServer in InstanceConfiguration.xml, like "\\myServer", "myServer.myDomain" and "myServer.myDomain.local", but all got the same result. I have checked online book and some forum, but nothing helpful. Could you help it out? Thanks in advance.

Regards,

Chris

|||

HI shyam,

Just got the book this week and im finding it very useful and helpful. The std MSDN examples are very short on documentation. I dont seem to have one issue though, Im currently going through chapter 6 and am finding that the scheduled subscriptions for the Music Store sample are not working.

Working through the database i can see that my NewSongByGenreSubscriptionProcessingTimes table is not being filled in. I looked a little deeper into the SQl statements and ran this

SELECT subscriptions.SubscriptionId, subscriptions.Created
FROM [SongAlerts].[NewSongByGenre] subscriptions

This unfortunately returns nothing, which looks to be the problem as my chronicle always stays empty. I've used your tool to add the scheduled subscriptions and unfortunately that does seem to work, its adding subscriptions, so i cant understand why the query above doesnt fire.

A little deeper and i see the two tables NSCurrentNewSongByGenreSubscriptions and NSFiringNewSongByGenreInterval are empty? dont really know what they do.

Dont suppose you can test and confirm that Chapter 6 does work correctly. I've been over it 3 times and am about to get a work mate to try on their machine, but so far no luck.

Aside from that little niggle, its an excellent book, the chapter on Custom Delivery Channels was worth it alone. :)

|||

For those who consider buying this book to prepare for their new project on SQL Server Notification Services, here's what I have to say:

1. I bought the author's previous book (on SQL NS 2.0 - for SQL Server 2000). Before I got it, I had only a very dim idea about what NS is and what it can do.

2. Two weeks later, I had a fully functional prototype of my application. It had only a subset of the real huge project's functionality (the project is truly HUGE!..), including a custom content formatter and a custom event provider. But it worked, and we are now just extending it. I mean, no need to refactor the code or start from scratch. Well, to tell you the truth, in those 2 weeks I worked quite a bit more than 8 hours a day, but it was worth it. My boss is still trying to throw some tricky questions on me (like, "What happens with our application IF..."), and there have been no questions so far that I was unable to answer. The book is just great!

3. My advice to you: work through all the samples (at least, in the first half of the book, or until you get a clear idea on how all the pieces of NS fit together). It's not nearly as bad as it sounds: the explanations and step-by-step instructions on how to do every little thing are so good that even a complete moron would be able to get it (and none of us are morons... I think... ;-)

4. I usually buy technical books only when I need to get up to speed with a particular technology as fast as possible. Shyam Pather's book exceeded all my expectations. The book reads as easily as my favorite science fiction books (and way easier than "The Lord of the Rings"). And almost as interesting as they are.

New SQL-NS 2005 Book

Folks,

I want to let everyone know that the 2005 update to my Notification Services book is now available for order. You can get it from http://www.amazon.com/gp/product/0672327791/.

This book has been completely updated for the 2005 release:

- All source code examples are now designed to work with the 2005 programming model and tools

- New chapters have been added to cover the new 2005 features (such as the NMO API, Hostable Execution Engine, and User-Defined Matching Logic)

I hope you find this useful. As always, I appreciate receiving any feedback you may have.

Thanks

-shyam

Hi Shyam,

I bought your book, and it's really good book which can tell me more detail.

Right now I met a problem when I was testing SMTP delivery channel in chapter 10. with local smtp service, the musicStore worked as expected, but if I changed to use another computer in the same domain, nothing happened. Checking the application event view, it said:

Notification Class Name: NewSong

Notification Status Info: The e-mail address or SMTP server value is not valid.

SMTP Server: 192.168.1.128

Message Recipients: emily@.work.com

I have tried other setting for SMTPServer in InstanceConfiguration.xml, like "\\myServer", "myServer.myDomain" and "myServer.myDomain.local", but all got the same result. I have checked online book and some forum, but nothing helpful. Could you help it out? Thanks in advance.

Regards,

Chris

|||

HI shyam,

Just got the book this week and im finding it very useful and helpful. The std MSDN examples are very short on documentation. I dont seem to have one issue though, Im currently going through chapter 6 and am finding that the scheduled subscriptions for the Music Store sample are not working.

Working through the database i can see that my NewSongByGenreSubscriptionProcessingTimes table is not being filled in. I looked a little deeper into the SQl statements and ran this

SELECT subscriptions.SubscriptionId, subscriptions.Created
FROM [SongAlerts].[NewSongByGenre] subscriptions

This unfortunately returns nothing, which looks to be the problem as my chronicle always stays empty. I've used your tool to add the scheduled subscriptions and unfortunately that does seem to work, its adding subscriptions, so i cant understand why the query above doesnt fire.

A little deeper and i see the two tables NSCurrentNewSongByGenreSubscriptions and NSFiringNewSongByGenreInterval are empty? dont really know what they do.

Dont suppose you can test and confirm that Chapter 6 does work correctly. I've been over it 3 times and am about to get a work mate to try on their machine, but so far no luck.

Aside from that little niggle, its an excellent book, the chapter on Custom Delivery Channels was worth it alone. :)

|||

For those who consider buying this book to prepare for their new project on SQL Server Notification Services, here's what I have to say:

1. I bought the author's previous book (on SQL NS 2.0 - for SQL Server 2000). Before I got it, I had only a very dim idea about what NS is and what it can do.

2. Two weeks later, I had a fully functional prototype of my application. It had only a subset of the real huge project's functionality (the project is truly HUGE!..), including a custom content formatter and a custom event provider. But it worked, and we are now just extending it. I mean, no need to refactor the code or start from scratch. Well, to tell you the truth, in those 2 weeks I worked quite a bit more than 8 hours a day, but it was worth it. My boss is still trying to throw some tricky questions on me (like, "What happens with our application IF..."), and there have been no questions so far that I was unable to answer. The book is just great!

3. My advice to you: work through all the samples (at least, in the first half of the book, or until you get a clear idea on how all the pieces of NS fit together). It's not nearly as bad as it sounds: the explanations and step-by-step instructions on how to do every little thing are so good that even a complete moron would be able to get it (and none of us are morons... I think... ;-)

4. I usually buy technical books only when I need to get up to speed with a particular technology as fast as possible. Shyam Pather's book exceeded all my expectations. The book reads as easily as my favorite science fiction books (and way easier than "The Lord of the Rings"). And almost as interesting as they are.

sql

Monday, March 19, 2012

New request is not allowed to start because it should come with valid transaction des

I have a C# windows service that uses MSMQ, DTC Transactions, SQL server
2005 and Notification services.
I am doing the following in the service:
OnStart
Create the queue
set the P Complete event
call Begin P
PComplete
WaitHandle[] waitHandle = new WaitHandle[] { new
AutoResetEvent(false) };
ThreadPool.QueueUserWorkItem(ProcessMessage, waitHandle[0])
Call End P
WaitHandle.WaiteAll(waitHandle)
queue.BeginP
ProcessMessage(object stateInfo)
AutoResetEvent are = (AutoResetEvent)stateInfo;
Create DTC Transaction
try
Message msg =
callResultQueue.Receive(MessageQueueTransactionType.Automatic);
are.Set();
retreive Message Body
Using (SQLConnection conn = new SQLConnection(connectionString))
conn.open
Write Message Body to database
If Messagebody.Status = 20
Update Notification Services
Commit DTC transaction
catch
Roll Back DTC Transaction
Quite often I am receiving the above message, I've googled it and all I've
come up with is people asking how to solve the error. Any information would
be greatly appreciated. I know the above is mixed psudeo code with code, if
additional code is required please let me know, I'll provide what I can.
Thanks
WayneIt would be helpful if you could post working code...
Noel
Wayne Sepega wrote:
> I have a C# windows service that uses MSMQ, DTC Transactions, SQL server
> 2005 and Notification services.
> I am doing the following in the service:
> OnStart
> Create the queue
> set the P Complete event
> call Begin P
> PComplete
> WaitHandle[] waitHandle = new WaitHandle[] { new
> AutoResetEvent(false) };
> ThreadPool.QueueUserWorkItem(ProcessMessage, waitHandle[0])
> Call End P
> WaitHandle.WaiteAll(waitHandle)
> queue.BeginP
> ProcessMessage(object stateInfo)
> AutoResetEvent are = (AutoResetEvent)stateInfo;
> Create DTC Transaction
> try
> Message msg =
> callResultQueue.Receive(MessageQueueTransactionType.Automatic);
> are.Set();
> retreive Message Body
> Using (SQLConnection conn = new SQLConnection(connectionString))
> conn.open
> Write Message Body to database
> If Messagebody.Status = 20
> Update Notification Services
> Commit DTC transaction
> catch
> Roll Back DTC Transaction
>
> Quite often I am receiving the above message, I've googled it and all I've
> come up with is people asking how to solve the error. Any information woul
d
> be greatly appreciated. I know the above is mixed psudeo code with code, i
f
> additional code is required please let me know, I'll provide what I can.
> Thanks
> Wayne

Saturday, February 25, 2012

New file notification

Hi All,

I am vey new to NS and here is what I am trying to achive:

User creates/copies over a file on the network. When this happens, I want to start an existing Job (SQL stored procedure) in SQL Server Agent.

Any lead (existing sample applications etc.) for me to start is apprecitated.

Thank you.

You can make use of the inbuilt "Event Provider" that monitors a specific folder. For more information, read about "Event Providers"|||Is this for some kind of ETL process? I'm not sure that SSNS is the best tool available for you here.

If you believe that it is the best tools, consider these options:

SSNS does come with a FileSystemWatcher event provider, but it looks for a valid XML document in the watched folder. If you're files are something besides a valid XML document, you can create a custom event provider using any .NET Framework language.

SSNS is designed to deliver notifications rather than start processes. So, you would need to create a custom delivery channel to start your SQL Server Agent process.

HTH...

Joe|||

Thank you Ragas. I looked at some online examples and worked it out. This article was quite helpfull:

http://www.devx.com/dbzone/Article/28522

|||

Thank you Joe. Yes, it is an ETL process and SSNS works pretty well. I downloaded this example and figured it out eventually: http://www.devx.com/dbzone/Article/28522

I added a trigger to start my SQL Agent job on one of the Notification Application tables when a new notification record is created.

AE

|||That's great, AE.

Is there anything that you could share with the group?

Thanks!

Joe|||

No Joe, just the link I provided for a good sample application in my previous message.

Ahmet

New file notification

Hi All,

I am vey new to NS and here is what I am trying to achive:

User creates/copies over a file on the network. When this happens, I want to start an existing Job (SQL stored procedure) in SQL Server Agent.

Any lead (existing sample applications etc.) for me to start is apprecitated.

Thank you.

You can make use of the inbuilt "Event Provider" that monitors a specific folder. For more information, read about "Event Providers"|||Is this for some kind of ETL process? I'm not sure that SSNS is the best tool available for you here.

If you believe that it is the best tools, consider these options:

SSNS does come with a FileSystemWatcher event provider, but it looks for a valid XML document in the watched folder. If you're files are something besides a valid XML document, you can create a custom event provider using any .NET Framework language.

SSNS is designed to deliver notifications rather than start processes. So, you would need to create a custom delivery channel to start your SQL Server Agent process.

HTH...

Joe|||

Thank you Ragas. I looked at some online examples and worked it out. This article was quite helpfull:

http://www.devx.com/dbzone/Article/28522

|||

Thank you Joe. Yes, it is an ETL process and SSNS works pretty well. I downloaded this example and figured it out eventually: http://www.devx.com/dbzone/Article/28522

I added a trigger to start my SQL Agent job on one of the Notification Application tables when a new notification record is created.

AE

|||That's great, AE.

Is there anything that you could share with the group?

Thanks!

Joe|||

No Joe, just the link I provided for a good sample application in my previous message.

Ahmet