I know I have to build in some ability to deal with a posion message. I was thinking that (sort of mentioned in the article http://msdn2.microsoft.com/en-us/library/ms166137.aspx) I would write a special stored procedure that would handle this situation. I don't know how I could activate this. I don't want to poll of course in a waitfor.
Hallo, I have some problems to handle the poison messages.
Messages are exchanged between 2 databases on the same SQL Server instance. I created a Trigger on the insert , that call the sp that begin the conversation(10 minutes Timeout) and send the message to the target queue.
On the target queue I activated a SP and the main code is:
BEGIN TRANSACTION
WAIT FOR (Receive (1) ..) timeout 5000
IF (@ErrorSave <> 0)
BEGIN
INSERT INTO [TestSender].[dbo].[tblErrorXMLMessages] VALUES ();
END
ELSE
if (@messagetypeName = N'Message')
BEGIN
exec [dbo].[sp_ProcessMessage] @message_body
END
ELSE IF (@messagetypeName = N'EndOfStream')
BEGIN
END CONVERSATION @dialog
END
COMMIT TRANSACTION
My communication has a strange behaviour:
if I type
Begin
insert into TriggerTable values(XMLMessage)
insert into TriggerTable values(XMLMessage)
....
insert into TriggerTable values(XMLMessage)
end
Everything work fine but If I write an insert of 1000 message coming from an another table and I use the
cursor login after I while the transmission stop because the Target queue become inactive. I can see my messages stuck in the Initiator transmission_queue so I think that there is some Poison message that cause 5 rollback and disable the receiver queue.
First I would like to isolate the wrong message and carry on with the insert, my application doesn't have to stop the conversation or return any error, but If I use the Sql server Debugger I'm not able to debug the Target queue's stored procedure.
I suppose that some error happens on the Target queue's stored procedure but how can I first at all find it out?
Maybe it has something to do with the transition wrapped around the RECEIVE command?
Hi! I have crl stored procedure with distributed transaction in it. I really need such transaction. When a poison message occurs 5 time my queue is turned off. I've read about handling poison messages in msdn (save transaction and rollback part of it), but it works only with local transaction. What should I do? An important point is that messages shoold be processed in right order, I can't receive message and put it to the end of queue. I want to try process poison message constantly. I doesn't want to stop receiving messages in that queue. Thanks.
I'm using the Service Broker to parallize my processes (I know that the Service Broker was not designed for that purpose), however it's working quite well.
I use the broker procedure to start procedures which all process all a part of the workload. When the procedure fails because of a lock timeout (or for that concern, for whatever reason), I rollback the transaction (which also roll back my message received on the queue so that it can be retried at a later time.). And this is where my problem lies, if there are 5 sequential rollbacks of messages then the poison message detection kicks in and disables the queue, stopping all the processing. :(
Is there a way to disable poison message detection? I have implemented my own stop-mechanism through a counter system on a per sub-task system so if I could disable poison message detection that would be ideal.
If this is not possible is there a way to turn the queue back on automatically so that it will continue processing the messages on the queue?
I am getting the following Error and I can't find it in the Manual.
Failure to send an event notification instance of type 'BROKER_QUEUE_DISABLED' on conversation handle '{5D273374-E84F-DB11-B3BC-0004239AB15C}'. Error Code = '8429'.
I have checked the service name for the notification and it appears to be okay.
Hi all, i searched everywhere but couldn't find any info on the following error that i'm currently receiving:
"The conversation endpoint is not in a valid state for SEND. The current endpoint state is 'DI'."
I understand that this is due to some problem in my send/receive protocol but how do i fix this problem so that i can continue with my testing? Right now i'm forced to drop my entire test database and reinstall everytime this message shows up because i can't send/receive any messages at that point. Is there anyway to get rid of it?
Hello again, I have some poison message detection in place, based on the BOL sample. My problem is that after the 5th message retry my queue goes down - that is the fifth retry on any message. In actuallity, the first message is retried 3 times and it is taken off the queue [for real], the second message comes in and on the second retry - pooof - the queue is down.
I though the poison mechanism should work on a per message basis. It there a setting for the queue I missed? Is my only chance for to fix this: re-enable the queue upon BROKER_QUEUE_DISABLED event notification?
In the "Example: Detecting a Poison Message" section, it reads: This Transact-SQL example shows a simple, stateless service that includes logic for handling poison messages. Before the stored procedure receives a message, the procedure saves the transaction. When the procedure cannot process a message, the procedure rolls the transaction back to the save point. The partial rollback returns the message to the queue while continuing to hold a lock on the conversation group for the message.
I run SB between 2 SQL servers. In profiler on an initiator side I see next error: 'This message could not be delivered because its message timestamp has expired or is invalid'. For the conversation we use best practice, i.e. target closes a conversation. Target side succeed to close conversation, but initiator still stay in DO (disconnect_outbound). What is a reasone for the error? What to do?
I see in profiler this error: "This message could not be delivered because its message timestamp has expired or is invalid" What is a reason for error?
I am having trouble specifying a message body that is valid. I mean for the client to send. If I leave it as null then everything is ok but if I create a memorystream and add a line of text it reports back it did not pass validation. I do not understand this and am not sure what to do. I need to send a message based on a code and text but do not know the format of the body that is allowed. The code I am refering to comes out of HelloWord_CLR because that is what I am formating my sample after. I call it the same way it calls the return message done in ServiceProc. I need to know the message format including body since this does not seem to work. A sample of the call is bellow.
// Create an empty request message
string Msg = "Hello";
MemoryStream body = new MemoryStream(Encoding.ASCII.GetBytes(Msg));
I have basic knowledge of SQL Server and Expert in MS Access
Know I want to change my Access Database into Database. Now what i required is when I create any Procedure then we use a condition helping keyword 'Where'
No what I required is when I execute any procedure using where clause It must open a Input Box where I put a condition
For Example when I create a procedure like this
create Procedure prc_Demo ( a int, as Select * from employee where emp_id = 'a' )
Something like that So I want when I execute this then there must be open a box where I type emp_id then it show matching the result
Has anyone encounterd this message in the sql log: ----- BACKUP LOG WITH TRUNCATE_ONLY or WITH NO_LOG is deprecated. The simple recovery model should be used to automatically truncate the transaction log. ----- DB's are in simple recovery mode and only a daily backup is being done on DB's. It almost seems that SQL is doing something internally.
i m using dynamic connection in rdl file firstly i m showing username and pwd . after this user name and pwd i make a connection string for my report. when i m entering invalid pwd, than report generate an error. and stop. is there any way by which i can trace error and flash a message box to user about his invalid user name or pwd.
I sent a message from Server A to B. I didn't end the conversation. The message is stuck in sys.tranmission_queue with no error message (empty) . the initiatorQueue is empty (no records). why doesn't the message get sent ?
We are running transactional replication on sqlserver 2000 and I see the following message: "The initial snapshot for article reason_type is not yet available" Followed 10 minutes later by a "timeout expired" event (we see lots of these). I see no reason for a snapshot to even be running at 3:04 AM but then, it apparently was so what can I say. The Snapshot agent history does not show any entries for the last year so that is a bit of a mystery. The table in question seems identical at both the publisher and subscriber (including content).
Any ideas why this message would appear? It appears that a snapshot for this article was somehow involved but I thought a snapshot was only created by specific request.
I have a service broker service and there are multiple clients that can put messages in the queue of that service. How do I check which message comes from which client? There is no field in the queue like message_senderId or something like that.
I have a SQL Express database on our server that is used for one of our websites when the website tries to write to the database I get the following error: - An attempt to attach an auto-named database for file D:lahwebsitesGiants North Walesapp_datadatabase.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. This error is very frustrating and I really can't find a way around it. I have done the following: -
Deleted the SQL Server Express folders under user preferences
Hi,I am trying to write some C# ASP.NET 2.0 code. I have created a web form to send data to my sql server 2005 database. When I compile the application and insert data then click on the submit button I get this error
"A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll" I have been trying to solve this for a few days now with no luck, so any help would be appreciated. I'll post below the source code of the web form (addOrder.aspx). It might be worth mentioning that I have created another web form in the same project called addCustomer.aspx. Like addOrder.aspx it is a web form, however it successfully inserts data in the database. 1 <%@ Page Language="C#" MasterPageFile="~/Default.master" Title="Add Order Page" %> 2 <%@ import namespace="System.Data.SqlClient" %> 3 <%@ Import Namespace="System.Data" %> 4 <%@ Import Namespace="System.Web" %> 5 <%@ Import Namespace="System.Configuration"%> 6 <%@ Import Namespace="System.Globalization"%> 7 8 <script runat="server"> 9 10 protected void Page_Load(object sender, EventArgs e) 11 { 12 13 } 14 15 protected void sumbitButton_Click(object sender, EventArgs e) 16 { 17 SqlConnection conn; 18 SqlCommand comm; 19 string connectionString = 20 ConfigurationManager.ConnectionStrings[ 21 "ShippingSystemConnectionString1"].ConnectionString; 22 conn = new SqlConnection(connectionString); 23 comm = new SqlCommand( 24 "INSERT INTO Order(CustomerID, " + 25 "NumberofItems, DescriptionsofItems, SafeItems) " + 26 "VALUES (@CustomerID, " + 27 "@NumberofItems, @DescriptionsofItems, @SafeItems)", conn); 28 comm.Parameters.Add("@CustomerID", System.Data.SqlDbType.Int); 29 comm.Parameters["@CustomerID"].Value = int.Parse(DropDownList1.SelectedValue); 30 comm.Parameters.Add("@NumberofItems", System.Data.SqlDbType.Int); 31 comm.Parameters["@NumberofItems"].Value = numofitemstxt.Text; 32 comm.Parameters.Add("@DescriptionsofItems", System.Data.SqlDbType.VarChar); 33 comm.Parameters["@DescriptionsofITems"].Value = descofitemstxt.Text; 34 comm.Parameters.Add("@SafeItems", System.Data.SqlDbType.VarChar); 35 comm.Parameters["@SafeItems"].Value = safetxt.Text; 36 try 37 { 38 conn.Open(); 39 comm.ExecuteNonQuery(); 40 Response.Redirect("Success.aspx"); 41 } 42 catch 43 { 44 } 45 finally 46 { 47 conn.Close(); 48 } 49 } 50 51 52 53 protected void CustomerIDList_SelectedIndexChanged(object sender, EventArgs e) 54 { 55 56 } 57 </script> 58 59 <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> 60 <table style="position: static"> 61 <tr> 62 <td style="width: 169px"> 63 Customer ID:</td> 64 <td style="width: 100px"> 65 <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" 66 DataTextField="CustomerID" DataValueField="CustomerID" Style="position: static"> 67 </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ShippingSystemConnectionString1 %>" 68 SelectCommand="SELECT [CustomerID] FROM [Customer]"></asp:SqlDataSource> 69 </td> 70 <td style="width: 178px"> 71 </td> 72 </tr> 73 <tr> 74 <td style="width: 169px"> 75 Number of Items:</td> 76 <td style="width: 100px"> 77 <asp:TextBox ID="numofitemstxt" runat="server" Style="position: static"></asp:TextBox></td> 78 <td style="width: 178px"> 79 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="numofitemstxt" 80 ErrorMessage="Number of Items Required" Style="position: static"></asp:RequiredFieldValidator></td> 81 </tr> 82 <tr> 83 <td style="width: 169px"> 84 Descriptions of Items:</td> 85 <td style="width: 100px"> 86 <asp:TextBox ID="descofitemstxt" runat="server" Style="position: static"></asp:TextBox></td> 87 <td style="width: 178px"> 88 <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="descofitemstxt" 89 ErrorMessage="Description Required" Style="position: static"></asp:RequiredFieldValidator></td> 90 </tr> 91 <tr> 92 <td style="width: 169px"> 93 Are Items safe:</td> 94 <td style="width: 100px"> 95 <asp:TextBox ID="safetxt" runat="server" Style="position: static"></asp:TextBox></td> 96 <td style="width: 178px"> 97 <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="safetxt" 98 ErrorMessage="Are Items Safe?" Style="position: static"></asp:RequiredFieldValidator></td> 99 </tr> 100 <tr> 101 <td style="width: 169px"> 102 <asp:ValidationSummary ID="ValidationSummary1" runat="server" Style="position: static" /> 103 </td> 104 <td style="width: 100px"> 105 <asp:Button ID="sumbitButton" runat="server" OnClick="sumbitButton_Click" Style="position: static" 106 Text="Submit" /></td> 107 <td style="width: 178px"> 108 </td> 109 </tr> 110 </table> 111 </asp:Content> 112 113 My order table in SQL server 2005 (express) looks like this:
I have the following sql statement which produced an error when I add the order by clause
SQL = "SELECT DISTINCT nc_department.department, Count(nonconformance.department_id) as 'events', ISNULL(SUM(nonconformance.nc_wafer_qty),0) as wafers FROM nc_department LEFT OUTER JOIN nonconformance ON nc_department.department_id = nonconformance.department_id WHERE nc_department.active = '1' GROUP BY nc_department.department ORDER by nc_department.order_id"
This is the error I get:
ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
I'm catching a primary constraint error in SQL and don't want to return the SQL error message back to the client. Is there any way to stop this. Thankyou
I finally installed MSDE and have the icon in my tray at the bottom of the screen. When I try to connect to a database using the wizard in the web matrix program I get this message: Unable to connect SQL Server does not exist of access denied Connection Open (Connect ()) What might be wrong?? Thanks for your help I'll get it soon (I hope) Del Dobbs
WHEN I TRY TO RUN A PROGRAM WHICH BINDS A DATAGRID CONTROL TO A SQL SERVER TABLE I GET A ERROR MESSAGE LIKE [SQL EXECEPTION LOGIN FAILED FOR HOMECOMPUTER/ASPNET] . IF U KNOW WHAT MIGHT COZ THE PROBLEM PLEASE TELL ME.
IAM RUNNING THE MICROSOFT SQL SERVER FORM MY HOME COMPUTER I.E (LOCAL) . IS THERE SOME SETTINGS THAT I NEED TO DO BEFORE RUNNING A PAGE WHICH CONNECTS TO THE SQL SERVER.
I am trying to set a text field as the primary key for a SQL SERVER Express 2005 Database in Visual Studio. I used the following Command:ALTER TABLE Tablename ADD PRIMARY KEY (fieldname);where you substitute table name and fieldname for the appropriate fields. The error message I am getting is:SQL Execution Error.Executed SQL statement: ALTER TABLE Lake ADD PRIMARY KEY(wbic);Error Source .Net SqlClient Data ProviderError Message: Column 'wbic' in table Lake is of a type that is invalid for use as a primary key column or index.Could not create constraint. See previous errors.How can I fix this so any type of field can be a primary key?
I am extracting data out of Lotus Notes into an Oracle DB using EM. I keep getting an error "[Lotus][ODBC Lotus Notes] Data value is not a valid date, time or timestamp" I went ahead and dropped the destination table, and changed all of the "date" columns to varchar's, redefined the transformation, and executed package again, but still get the error. Any ideas?
I am running across this error message: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Has anyone seen this before? Can you perform a fetch or do a loop? I am kind of new at sql and not really sure how either of these work or how to start to code something like that.