Any *simple* External Activation Examples Available?
Feb 13, 2007
BOL only seems to say that you can do it w/o really showing how, and the ExternalActivator sample at gotdotnet.com contains so much functionality I'm not sure what's required just for the external activation. Are there any docs or samples out there that focus on how to do it w/o obscuring the matter with a bunch of other functionality? (I prefer docs to project samples, b/c the samples tend to have hacks like hardcoded paths and connection strings so that they rarely work correctly right out of the box.)
I have a set of service broker services setup that rely on external activation to process messages. I'm using the GotDotNet ExternalActivator, and it launches console applications that do the actual retrieval from the queues. The console applications are written to run continuously to avoid the cost of starting up .NET based console apps over and over again.
I am observing very odd timing behavior. With the receive queues empty and the external activator configured to run a minimum and maximum of 5 instances, I observe in SQL Profiler that most of the receive operations finish in about the same amount of time as my WAITFOR command in my receive stored procedure. However, there is usually one receive command that consistently takes upwards of 30 seconds and often causes sql timeout exceptions to be thrown. I know that I could code around this, but I wasn't really expecting this behavior.
Does anyone have any thoughts on why it might be occurring? I would have expected to routinely see my receive operations taking 15 seconds, give or take, especially when the queue is empty. Also, I have observed this behaviour on both SQL 2k5 Express and Dev Editions, so I don't think it's a version thing.
The stored procedure I am using to do the receive is:
I have been going over the samples from PDC 2005 and trying to run the External Activator program in section 2 'CLR Services'. After sending a message to the Inventory Queue, I see that 'dm_broker_queue_monitors' table has a row in the table, with the state column shown as 'NOTIFIED', but the ExternalActivator program never gets notified of the event and therefore never launches the 'InventoryServer' program.
Querying the [ExternalActivatorQueue] shows no rows.
Querying the [Inventory Queue] shows messages are waiting to be received.
Executing the 'activator' command in the ExternalActviator program shows
Notification service 'ExternalActivator' on SQL Server 'DBSERVER' and Database 'In ventory' is connected to the database and working.
I am attempting to use Service Broker to distribute message processing across multiple machines. I have mulitple queues setup to all notify a single service with the QUEUE_ACTIVATION event. My external application then sits in a "WAITFOR RECEIVE" on that event queue and when it receives a message for a particular queue, will begin processing the messages in that queue if that particular server is configured to process messages of that type.
My problem is that once one server starts receiving messages, the others don't always start processing and I end up with one server attempting to process all the messages by itself.
What is the best way to notify multiple servers that there are messages in a particular queue which need processing? I really like the WAITFOR clause since it eliminates the need to poll the server intermittently, however I also don't want to have each server sit in a WAITFOR RECEVE on every queue to avoid polling, I could easily end up with around a thousand connections sitting in that state. I also don't know how many servers there will be processing messages, so I'd like to avoid having to setup an event queue for each server.
(Remus, if you read this, I was at the SQL Performance Lab in building 35 about a month ago and we spoke about using Service Broker in our application.)
Hi all, I want to do SQLCLR by Connecting to SQL Express User Instances in Management Studio via VB 2005 Express and I have read the following articles and books: (i) Connecting to SQL Express User Instances in Management Studio in http://blogs.msdn.com/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-insta... (ii) Managing SQL Server Express with SQL Server 2005 Management Studio Express Edition in http://www.microsoft.com/technet/sql/2005/mgsqlexpwssmse.mspx (iii) Chapter 16 - Going Beyand Transact-SQL: Using the SQL Common Language Rutime (SQLCLR) in Microsoft SQL Server 2005 Express Edition for Dummies (iv) Chapter 21 - Working with the Common Language Runtime in Microsft SQL Server 2005 Programming for Dummies (v) Chapter 4 - Introduction to Common Language Runtime (CLR) Integration in Programming SQL Server 2005 by Bill Hamilton. I want to create an SQLCLR project "HelloWorld" by Connecting to SQL Express User Instances in Management Studio via VB 2005 Express. But I am still not sure how to get it started, because I do not understand the following things: (1) Pipe Name for a User Instance, (2) Enabling (or Disabling) the CLR by using Transact-SQL, (3) Creating a Transact-SQL script, (4) Creating an Assembly, (5) Creating a backup device, etc. I need to see some simple examples of SQLCLR by Connecting to SQL Express User Instances in Management Studio via VB 2005 Express. Please help and tell me where in the websites I can find them.
Are there any examples of using DTS and XML/XLS? specifically, importing data. I have searched through BOL and cant find any, nor is there any reference to XML in the book "Professional SQL 2000 DTS"
I see a lot of example, but where do these example procedures go. Likedeclare (whatever)?below is an example i read. Where do you put this to make it execute, is itthe view screen or the stored procedure screen?I'm using MSDE now to learn, and I can't get nothing working except simpleselect query statements.In the northwind example (northwindcs), how would I do a parameter querylike this:Have a dialog box ask user to enter customerid to bring up. (in a query nownot a form)Also, how would you check if a certain customerid exist? Example, CHOPS isone customerid. If I wanted to use a query to check if it exist, and returnno records, but just do an action (like add a record) if it didn't exist,how?[color=blue]> CPU SQL> (ms)> -- Convert to varchar (implicitly) and compare right two digits> -- (original version -- no I didn't write it)> 4546 select sum(case right(srp,2)> when '99' then 1 when '49' then 1 else 0 end)> from sf>> -- Use LIKE for a single comparison instead of two, much faster> -- Note that the big speedup indicates that> -- CASE expr WHEN y then a WHEN z then b .> -- recalculates expr for each WHEN clause> 2023 select sum(case when srp like '%[49]9' then 1 else 0 end)> from sf[/color]I tried some variations of this, and indeed it seems that there is a costwhen the expression appears with several WITH clauses. I tried a variationof this, where I supplemented the test table with a char(2) column, so Icould factor out that the WITH clauses themselves were not the culprits.CREATE TABLE realthing (realta real NOT NULL,lasttwo char(2) NOT NULL)goINSERT realthing (realta, lasttwo)SELECT r, right(r, 2)FROM (SELECT r = convert(real, checksum(newid()))FROM Northwind..Orders aCROSS JOIN Northwind..Orders b) AS fgoDBCC DROPCLEANBUFFERSgoDECLARE @start datetimeSELECT @start = getdate()SELECT SUM(CASE right(realta, 2)WHEN '99' THEN 1WHEN '49' THEN 1WHEN '39' THEN 1ELSE 0 END)FROM realthingSELECT datediff(ms, @start, getdate()) -- 20766 ms.goDBCC DROPCLEANBUFFERSgoDECLARE @start datetimeSELECT @start = getdate()SELECT SUM(CASE WHEN right(realta, 2) LIKE '[349]9' THEN 1 ELSE 0 END)FROM realthingSELECT datediff(ms, @start, getdate()) -- 8406 ms.goDBCC DROPCLEANBUFFERSgoDECLARE @start datetimeSELECT @start = getdate()SELECT SUM(CASE lasttwoWHEN '99' THEN 1WHEN '49' THEN 1WHEN '39' THEN 1ELSE 0 END)FROM realthingSELECT datediff(ms, @start, getdate()) -- 920 ms.goDBCC DROPCLEANBUFFERSgoDECLARE @start datetimeSELECT @start = getdate()SELECT SUM(CASE WHEN lasttwo LIKE '[349]9' THEN 1 ELSE 0 END)FROM realthingSELECT datediff(ms, @start, getdate()) -- 1466 ms.Thus, when using the char(2) column LIKE is slower despite that thereis only one WHEN condition. So indeed it seems that right(realta, 2)is computed thrice in the first test.Another funny thing is the actual results from the queries - they aredifferent. When I ran:select count(*) from realthing where lasttwo <> right(realta, 2)The result was about half of the size of realthing! I can't see thatthis difference affects the results though.Now, your article had a lot more tests, but I have to confess thatyou lost me quite early, because you never discussed what is theactual problem. Since you are working with floating-poiont numbersthere is a great risk that different methods not only has differentexecution times, but also gives different results.--Erland Sommarskog, SQL Server MVP, Join Bytes!Books Online for SQL Server SP3 athttp://www.microsoft.com/sql/techin.../2000/books.asp
What is the purpose of the "N" preceding the parameter values in theSQL examples?Here is an example copied from Books Online, SP_ATTACH_DB:EXEC sp_attach_db @dbname = N'pubs',@filename1 = N'c:Program FilesMicrosoft SQLServerMSSQLDatapubs.mdf',@filename2 = N'c:Program FilesMicrosoft SQLServerMSSQLDatapubs_log.ldf'I've found that my sp_attach_db routine works without the "N", but Ineed to know what it is that I don't know.Thank you everybody for all your help.
Where can i find examples of T-SQL executed by one instance of SQL Server 2000 to communicate to a 2005 SQL Broker instance (both located on the same server)?
Hello, Can anyone direct me to some sample charts created with 2000 Reporting Services? Looking for the advanced capabilities and quality of the charts.
hican someone help me. i am looking for free databanks. i could use asexamples for testing the usage of them. just for a start getting intothis field.i appreciate your help. thx ann xx
Hello there:I am trying to configure an excel worksheet as an Writebackapplication but I want to block some cells in the page and combiningcell protecion does nos alloudm to insert rew rowns
Hi..Im newbie on Report Services with VS.NET... I made a cube on olap.. andI try to lear some mdx for my reports..But, in the report designer... I need a lot of help..Please.. anybody.. can help me¨??Thanks a lot...!Karina Gamez*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
I was just wondering if there are any examples on how to work with the Script Editor, and more specifically how to use the DirectRow method? I've seen some examples that say that the editor automatically creates the methods DirectRowTo<output buffer>, but it doesn't say how that is done. If I just specify Row.DirectRow(output buffer #), it says that the method is protected.
Any help or just pointing me in the right direction would be greatly appreciated!
I have been creating SSIS packages programmatically and have run into somewhat of a dead end. I have found the examples provided with the SQL 2005 install very helpful, but they only cover setting up three tasks: Sort task, OleDB Source and a Flat File Destination.
Does anyone have any examples or knows of examples of using the Merge Join task and the Conditional Split task?
I'm doing it all programmatically and so far I'm having trouble finding much in the way of documentation or examples.
I'm new to SQL Server Technology and am trying to learn how to create a Mobile Device application and to sync it with a desktop application that uses Access. I have found a lot of information but some of it doesn't seem to make sense.
I found this blog: http://blogs.msdn.com/sqlservereverywhere/archive/2006/08/29/729730.aspx which is the announcement of Access Database Synchronizer (ADS) CTP. I downloaded it and installed it with all the prerequisites. This is the part i can't understand:
"The CTP setup installs the desktop component required for synchronizing Microsoft Access database with SQL Server Everywhere Edition database on the device."
I cannot seem to find the desktop component to try out! The Readme shows you how to pull and push data but i can't see where the desktop data sync wizard is located. Should there be something installed on my desktop that i can see?
Also, there doesn't seem to be much help or examples around on this component as yet. Can anyone point me in the right direction for examples, help, or tutorials on this.
This paragraph also confuses me:
"Note: As of today only SQL Server Mobile Edition is available for devices. SQL Server Everywhere Edition whould be available for devices at time of SQL Server Everywhere Edition RTW whihc is planned for November 2006".
Does this mean SQL Everywhere won't work on mobile devices until November?
Sorry for all the questions but i'm still trying to learn this stuff so i can write my application for Windows CE. Thanks in advance.
books online mentions examples stored on the pc when sql is installed, but the examples are not on my machine. i know they are on the disk somewhere, but i dont have the disk. i have tried going to add remove programs and adding extra sql components but i cant find the examples there either. can anyone tell me where to find them?
i have posted here a few times on my endpoint issues but i cant find a resolution so im approaching the issue from a different angle. can you guys tell me how you create and consume endpoints, preferably with the endpoint code, the url you use to see the wsdl, and any network/pc settings you may have altered to get endpoints to work. im looking for tips or steps that may not be included in basic endpoint tutorials. I really am stuck and have no idea what else to try. thanks all
Does anyone know where I can find a Northwind end to end database solutions (examples) written in ASP.NET (VB). I would like to reverse engineer this project to learn more about ASP.NET?
I'm learning by going through the tutorials and such and modifying the code to try and learn how to do more and different things.
I have a MSDE Database, and I'm building a query from the WebMatrix Code Builder.
I can get a Select and Where to work on a "Category" colum as String; to return from a text box control (where I enter the name) and on button click.
What I would like to learn how to do and am having trouble is do a select Where "Category" (string) and "Status"(Int) are the same.
I have two Seperate Textboxes after i make the Where / And Query, but I'm not sure i have the button click code right.
I have included the code below - Sorry if this is so basic ;-) - The Sub_Button1 Click is at the end.
Function ShowRecords(ByVal category As String, ByVal status As Integer) As System.Data.DataSet Dim connectionString As String = "server='(local)'; trusted_connection=true; database='SalesContacts'" Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)
Dim queryString As String = "SELECT [Contact].* FROM [Contact] WHERE (([Contact].[Category] = @Category) AND ("& _ "[Contact].[Status] = @Status))" Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand dbCommand.CommandText = queryString dbCommand.Connection = dbConnection
Dim dbParam_category As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter dbParam_category.ParameterName = "@Category" dbParam_category.Value = category dbParam_category.DbType = System.Data.DbType.String dbCommand.Parameters.Add(dbParam_category) Dim dbParam_status As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter dbParam_status.ParameterName = "@Status" dbParam_status.Value = status dbParam_status.DbType = System.Data.DbType.Int32 dbCommand.Parameters.Add(dbParam_status)
Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter dataAdapter.SelectCommand = dbCommand Dim dataSet As System.Data.DataSet = New System.Data.DataSet dataAdapter.Fill(dataSet)
Return dataSet End Function
Sub Button1_Click(sender As Object, e As EventArgs) DataGrid1.DataSource = ShowRecords(CStr(TextBox1.Text)&(CInt(TextBox2.Text))) DataGrid1.DataBind() End Sub
What's the best way to keep an audit trail of every insert, update, and delete of a certain table? Any example code out there? I'm thinking in terms of a trigger for each event, for instance, the update trigger would insert a new record into the audit table with a field for each column in the deleted table and a field for each column in the inserted table.
Am new to SSIS, I saw only few examples from the textbook but i need to learn a lot from the ssis , so can any one suggest me where can i find good examples and small projects , so that i can get more practise on the ssis.
Recently there has been questions on some of the newsgroups about examples for SQL Server Service Broker. So, yesterday on a flight back to England I crofted up three different SQL Server projects as examples: LocalSampleRemoteSampleServer1RemoteSampleServer2 All three examples are jus your very basic €œHello World€? example, but they show: LocalSample €“ communication between two databases on the same SQL server instance. MasterKeys in a database and the database being TrustWorthyRemoteSampleServerX €“ These two samples are meant to run on two different machines/instances and in the samples you set up both transport security and dialog security by using Certificates. Download the zip file from here [0], unzip and read the README.txt file, and €“ Have Fun!! [0] : http://staff.develop.com/nielsb/code/servicebrokerexamples.zip
I have installed SQLServer 2005 along with Visual Studio 2005 Professional. I am trying to study some database examples (CreateDB for example) but I always get the mesage that I need the Northwind database installed. I cannot find it anymore in the examples provided for SQL Server 2005. In the links provided after the error is displayed, I find that I should install SQL Server Express. I do not really want that because of some possible conflicts with the other 2005 version of SQL Server.
Is there a place I can download the Northwind database from? Will it work with SQL Server 2005?
Hi, I have seen many examples at MSDN library related to SQL Querries in all queries one thing is same the way they use tables in there queries. BUT wht is this really i am not getting this, can anyone tell me.. the code and the problem is as follows:
Code Snippet FROM Purchasing.ProductVendor JOIN Purchasing.Vendor ON (ProductVendor.VendorID = Vendor.VendorID)In the above code u see "Purchasing.ProductVendor", I want to ask that wht is this Purchasing Stands for, If we suppose that purxchasing is the database name then also normally we use database name as Purchasing.dbo.ProductVendor BUT I am not getting that what is this, Please if someone knows then explain it to me, Thanks.
I was testing around with a sample service broker app using activation, and came across an interesting question. The little app sends a series of four messages to a queue, either on the same conversation or on seperate ones. Each message invokes one stored procedure in my activation procedure. All the procedure does is enter a record into a test table and then wait for an allotted amount of time. In my example, the first message called a proc that waited 20 sec, the 2nd one that waited 10 seconds, the third 5 seconds, and the 4th 1 second. I am using internal activation on the queue. It seemed that in both scenarios (sending on 4 separate conversations and on one conversation) the procedures executed "almost" sequentially. "Almost" meaning that the first procedure was done before the last one started executing. It makes sense to me that this would happen where I sent them on the same conversation, but not really when I sent them on 4 seperate ones. Is it because when I call a procedure from my activation procedure it locks the queue so that another message cannot be processed (I'm processing a message at a time)? How could I make it so that the 4th procedure (the one that only waits 1 second) returns before the 1st procedure (the one that waits 20 seconds)?
Hi, is there any tutorials out there that teaches newbies how to use Stored Procedures? I am using SQL Express with ASP.Net 2.0. Please help and thanks in advance.
The free one that i have downloaded doesn't seem to be able to view the database. Is there any free database which i can download? Please advise. Thanks.
Near the end of 2005 Microsoft made available some sample C# apps that implemented custom SSIS tasks and components. I think Doug Ladenshlager may have had a heavy hand in building them.
Does anyone know where they are? I can't darned well find them!
My C# .NET application is currently using the System.Data.OleDb namespace to access SQL Server 2000 and SQL Server Express databases. I would like to begin using SQL Server Compact Edition to access a local database that has the same structure as the others. I'd like to use the same code regardless of the data source, so I would prefer to use System.Data.OleDb instead System.Data.SqlServerCe.
Where can I find examples of the use of System.Data.OleDb with SQL Server Compact Edition? Some of the specific questions I have are:
1.) How do I build the connection string for the OleDbConnection object? 2.) What are the limitations, if any, of using OleDb instead of SqlServerCe?
One is Basket_ODS and the other is Intelligence_ODS. I am using service broker activation on a queue to move data from the Basket_ODS table to the Intelligence_ODS database. Previously I was able to move from table to table in Basket_ODS, however now that I am moving it to another database on the same instance it is no longer working.
If I set my active connection in SQL Management Studio to this user(BrokerUser) and execute the "move" procedure it works. When activated by Service Broker however, it does not. Here is the error message:
2006-05-09 14:47:52.940 spid86s The activated proc [ODS].[ProcessOrderQueue] running on queue Basket_ODS.ODS.Order Process Queue output the following: 'The server principal "BrokerUser" is not able to access the database "Intelligence_ODS" under the current security context.'
I'm sure I missed something becasue it works fine in the same database. BrokerUser has datareader and datawriter in both databases.