I am getting SQLException when I connect one of SQL Server 2000 Integrated Security host. I would like to know how to correct this problem.
An exception occurred during the DBComms.receive method. Operation:An existing connection was forcibly closed by the remote host. Context:(1) [Thread[main,5,main], IO:adc97, Dbc:8460d]. PktNum:1. TotalReceived:173. PktSize:4,096.
I am getting SQLException when I connect SQL Server 2005. I would like to know how to correct this problem. I get this error randomly. Never seenit before. Sometimes I get this error one day later from application begins, sometimes two days later, sometimes 3 day later.
DBCP borrowObject failed: com.microsoft.sqlserver.jdbc.SQLServerException: An exception occurred during the DBComms.receive method. Operation:Connection reset. Context841) [Thread[http-8080-Processor18,5,main], IO:457d2, Dbc:1a642]. PktNum:0. TotalReceived:0. PktSize:4,096. org.apache.commons.dbcp.DbcpException: com.microsoft.sqlserver.jdbc.SQLServerException: An exception occurred during the DBComms.receive method. Operation:Connection reset. Context841) [Thread[http-8080-Processor18,5,main], IO:457d2, Dbc:1a642]. PktNum:0. TotalReceived:0. PktSize:4,096. at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:85) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:184) at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source) at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:117) at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312) at org.apache.struts.util.GenericDataSource.getConnection(GenericDataSource.java:276) at com.y.util.DbAccess.getConnection(DbAccess.java:29) at com.y.biz.UserMgr.leftDays(UserMgr.java:404) at com.y.action.LoginAction.login(LoginAction.java:194) at sun.reflect.GeneratedMethodAccessor303.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:220) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:534) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: An exception occurred during the DBComms.receive method. Operation:Connection reset. Context841) [Thread[http-8080-Processor18,5,main], IO:457d2, Dbc:1a642]. PktNum:0. TotalReceived:0. PktSize:4,096. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source) at com.microsoft.sqlserver.jdbc.DBComms.receive(Unknown Source) at com.microsoft.sqlserver.jdbc.IOBuffer.sendCommand(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.changeSettings(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source) at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:83) ... 44 more
Web Server: CPU 2*1.66G, 4GB ram, 146GB Windows 2003 Server JDK 1.4.2 Tomcat 5.0 Driver Name: Microsoft SQL Server 2005 JDBC Driver
JDBC Driver Version 1.0 Use struts connection pool in application.
Database Server: CPU 2*1.66G, 4GB ram, 4 x 146GB Windows 2003 Server SQL Server 2005, Product Version: 9.00.1399
While doing performance testing on a Tomcat based web application using the v1.1 JDBC driver connecting to SQL Server 2005, the tomcat server has been throwing the above exception at a fairly low rate. I have seen some related issues in the forums with v1.1 of the MS JDBC driver, but those were asking about connection reset related errors. In this case the 'invalid packet header' exception is consistently seen. I am in the process of repeating the test with some additional application side logging turned on, and have tried enabling FINEST level logging for the driver, but that leaves me with a 500MB log file and so far no instances of that exception in question being thrown. This is not unusual, the error has only been seen about 14 times in about 20 tests, with each test running about an hour and a half.
A few quick tests with the 1.2 driver did not throw this exception, but did throw a high number of '[Connection|Statement|Resultset] Closed'
While I gather more information, I was wondering if there is anything significant in this particular exception type that could point to a more specific set of tests I could run?
The exceptions seen so far:
Exception #1:
java.lang.NullPointerException at com.microsoft.sqlserver.jdbc.DBComms.receive(Unknown Source) at com.microsoft.sqlserver.jdbc.DBComms.receive(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.doCloseServerCursor(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement$CloseServerCursorRequest.execute(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.closeServerCursor(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerResultSet.close(Unknown Source) at com.X.db.CSInternalDB.close(CSInternalDB.java:950) at com.X.db.CSQuery.close(CSQuery.java:169) at com.X.container.ContainerManager.getFolderContent(ContainerManager.java:1313) at com.X.container.ContainerCommands.getContent(ContainerCommands.java:1086) at com.X.container.ContainerCommands.execCommand(ContainerCommands.java:192) at com.X.BaseHandler.getObjectFromDoc(BaseHandler.java:169) at com.X.BaseHandler.processDOM(BaseHandler.java:284) at com.X.Dispatcher.execIt(Dispatcher.java:546) at com.X.Dispatcher.execCommand(Dispatcher.java:333) at com.X.BaseHandler.getObjectFromDoc(BaseHandler.java:169) at com.X.X.execute(X.java:600) at com.X.HttpReceiver.doRequest(HttpReceiver.java:275) at com.X.HttpReceiver.doGet(HttpReceiver.java:181) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.cluster.tcp.ReplicationValve.invoke(ReplicationValve.java:346) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source)
#2:
java.sql.SQLException: The DBComms.receive operation resulted in an invalid packet header type:-86. PktNum:0. nReceived:8. at com.X.db.CSPreparedStatement.executeQuery(CSPreparedStatement.java:474) at com.X.db.CSAnalyzer.executeQuery(CSAnalyzer.java:485) at com.X.db.CSQuery.sqlPrepareExecute(CSQuery.java:559) at com.X.form.FormManager.getInternalFormProps(FormManager.java:1803) at com.X.form.FormManager.getInternalFormProps(FormManager.java:1762) at com.X.route.RoutingCommands.genericPrepareRoutingPage(RoutingCommands.java:5618) at com.X.route.RoutingCommands.prepareRoutingPage(RoutingCommands.java:3899) at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.X.iplugin.DynamicCommandMethod.execute(DynamicCommandMethod.java:35) at com.X.route.RoutingCommands.execCommand(RoutingCommands.java:209) at com.X.BaseHandler.getObjectFromDoc(BaseHandler.java:169) at com.X.BaseHandler.processDOM(BaseHandler.java:284) at com.X.Dispatcher.execIt(Dispatcher.java:546) at com.X.Dispatcher.execCommand(Dispatcher.java:333) at com.X.BaseHandler.getObjectFromDoc(BaseHandler.java:169) at com.X.X.execute(X.java:600) at com.X.HttpReceiver.doRequest(HttpReceiver.java:275) at com.X.HttpReceiver.doGet(HttpReceiver.java:181) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.cluster.tcp.ReplicationValve.invoke(ReplicationValve.java:346) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source)
Hi,I am trying to write a method which needs to call a stored procedure and then needs to get the response of the stored procedure back to the variable i declared in the method. private string GetFromCode(string strWebVersionFromCode, string strWebVersionString) { //call stored procedure } strWebVersionFromCode = GetFromCode(strFromCode, "web_version"); // is the var which will store the response.how should I do this?Please assist.
Greetings everyone, I am attempting to build my first application using Microsofts Sql databases. It is a Windows Mobile application so I am using Sql Server Compact 3.5 with Visual Studio 2008 Beta 2. When I try and insert a new row into one of my tables, the app throws the error message shown in the title of this topic. '((System.Exception)($exception)).Message' threw an exception of type 'System.NotSupportedException'
My table has 4 columns (i have since changed my FavoriteAccount datatype from bit to Integer) http://i85.photobucket.com/albums/k71/Scionwest/table.jpg
Account type will either be "Checking" or "Savings" when a new row is added, the user will select what they want from a combo box.
Next is a snap shot of my startup form. http://i85.photobucket.com/albums/k71/Scionwest/form.jpg
Where it says "Favorite Account: None" in the top panel, I am using a link label. When a user clicks "None" it will go to a account creation wizard, and set the first account as it's primary/favorite. As more accounts are added the user can select which will be his/her primary/favorite. For now I am just creating a sample account when the label is clicked in an attempt to get something working. Below is the code used.
account.FavoriteAccount = 1;//datatype is an integer, I have changed it since I took the screenshot.
financesDataSet.BankAccount.Rows.Add(account); //The next three lines where added while I was trying to get this to work. //I don't know if I really need them or not, I receive the error regardless if these are here or not.
catch (global:ystem.InvalidCastException e) { //Stops at the following line, this error was caused by 'if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)'
throw new global:ystem.Data.StrongTypingException("The value for column 'FavoriteAccount' in table 'BankAccount' is DBNull.", e);
I have no idea what I am doing wrong, all of the code I used I retreived from Microsofts help documentation included with VS2008. I have tried used my TableAdapter.Insert() method and it still failed when it got to
if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)
in my refreshDatabase() method it still failed.
When I look, the data has been added into the database, it's just when I try to retreive it now, it bails on me. Am I retreiving the information wrong?
I'm getting the following error from a few hosts that are querying a db in SQL Server 2005. The error has occurred while executing various queries that we would expect to return various sized result sets (from a couple rows to a couple million rows). Many hosts have never experienced the error but it is occurring fairly frequently on a couple.
using Windows Server 2003 on both the jdbc client and the DB host.
using jdbc driver from sqljdbc_1.1
netstat doesnt increment the TCP connection reset count after this error occurs.
using standard sql server authentication.
-----------------------------------------
com.microsoft.sqlserver.jdbc.SQLServerException: A DBComms.error occurred while reading input. Context:Read packet header, Unexpected end of stream, readBytes:-1. Negative read result PktNumber:0. ReadThisPacket:0. PktDataSize:4,096.
When running the package in VisualStudio it runs properly, but if I let this package run as part of an SQL-Server Agent job, I got the message "The script threw an exception: Exception of type 'System.OutOfMemoryException' was thrown." on my log and the package ends up with an error.
Both times it is exactly the same package on the same server, so I don't know how the debug or even if there is anything I need to debug?
Hi, I just have a Dataset with my tables and thats it I have a grid view with several datas on it no problem to get the data or insert but as soon as I try to delete or update some records the local machine through the same error Unable to find nongeneric method... I've try to create an Update query into my table adapters but still not working with this one Also, try to remove the original_{0} and got the same error... Please help if anyone has a solution
In working through some examples, sometimes I will see this pattern for receiving messages: What is the purpose of the "nested" WAITFOR (RECEIVE? What is this actually doing? Is it receiving the same message in both RECEIVE?
WAITFOR ( RECEIVE @dh = [conversation_handle], @message_type = [message_type_name], @message_body = CAST([message_body] AS NVARCHAR(4000)) FROM [Queue]), TIMEOUT 1000; WHILE @dh IS NOT NULL BEGIN IF @message_type = N'http://schemas.microsoft.com/SQL/ServiceBroker/Error' BEGIN RAISERROR (N'Received error %s from service [Target]', 10, 1, @message_body) WITH LOG; END END CONVERSATION @dh; COMMIT; SELECT @dh = NULL; BEGIN TRANSACTION; WAITFOR ( RECEIVE @dh = [conversation_handle], @message_type = [message_type_name], @message_body = CAST([message_body] AS NVARCHAR(4000)) FROM [Queue]), TIMEOUT 1000; END COMMIT;
Other times I will see this pattern for receiving messages: Why do a RECEIVE TOP(1) instead of just a RECEIVE?
WAITFOR(RECEIVE TOP(1)
@conversationHandle = conversation_handle,
@messageTypeName = message_type_name,
@messageBody = message_body
FROM [Queue]), TIMEOUT 1000;
And other times I will see this pattern for receiving messages: What is the purpose of RECEIVING into an in-memory table when you can just process the message directly?
WAITFOR(RECEIVE
queuing_order,
conversation_handle,
message_type_name,
message_body
FROM [Queue]
INTO @tableMessages), TIMEOUT 1000;
IF (@@ROWCOUNT = 0)
BEGIN
COMMIT;
BREAK; END
What is the difference between the three approaches from an architectural and performance perspective? I need to process messages as fast as possible and I'm not sure why or when each should be used. Also, does the timeout have any impact on how FAST messages will be processed, or is it exactly what it says - a timeout - if a message is not found within the period then the procedure will break?
I am trying to set up a stored procedure to retrieve to 20 messages from a queue into a table to implement a batched process. I have the following code in a stored procedure.
WAITFOR ( RECEIVE top (20) -- get batched so that we can process same listid once message_type_name, message_body, -- the message contents conversation_handle -- the identifier of the dialog this message was received on FROM dbo.target into @PayloadData ), TIMEOUT 3000 -- if the queue is empty for three second, give UPDATE and go away
However, the stored procedure is only retrieving 1 message at a time from the queue. Did I miss some other setting
Hello Guys, I really need you help to debug this query. OBJECTIVE:THE QUERY SHOULD GIVE ME THE FIELDS I MENTIONED IN THE FIRST QUERY WITH THE CONDITIONS BELOW. CONDITION 1: RateReview field should have yesterday's date CONDITION 2: Email will be send to customer only once so Customer_GUID is UniqueIdentifier CONDITION 3: Customer shouldnt' have opted to get out from receiving any email so Termination field should be NULL ONe Customer can have many transwactions Is there any way i write the code specifying that no email should be sent more than once evereven if customer buys 10 tickets. Only one email sent so i need to specify that if this email has gone to particulare CUSTOMER_GUID then Ignore that record and do not send any email. This would be done by some tool known as StrongMail.
SELECT CAST(a.Transaction_GUID AS varchar(36)) as Transaction_GUID, CAST(a.Customer_GUID AS varchar(36)) as Customer_GUID, Film_id as MovieId, First_nm as FirstName, Last_nm as LastName, Email_nm as EmailAddress,
from ( select MIN(CAST(customer_guid AS varchar(36))) as Customer_GUID, Transaction_GUID from tblTransaction (nolock) where RateReview_dm > DATEADD(dd,-1,GETDATE()) and RateReview_dm < GETDATE()
and Terminate_dm is null and customer_guid not in ( select CAST(customer_guid AS varchar(36)) as Customer_GUID from tblTransaction (nolock) where RateReview_dm > DATEADD(dd,-1,GETDATE()) and RateReview_dm < GETDATE()
and Terminate_dm is null ) group by transaction_guid, customer_guid )z inner jointblTransaction a onz.Transaction_GUID = a.Transaction_GUID
Hai ,I created a table with primary key clustered. I have entered the datathru E.Manager . If a close the table and open it again , Ii shows therows with the (default) ascending order. Is, there any way to get therows in the user entered order(neither asc or dec order)With ThanksRaghu
I built a system where I am sending batches of messages using a single conversation. I want to pull these messages out of my queue using Service Broker. I may have more than one batch sitting in the queue waiting to be picked up, so....
In my SSIS package i started by getting a unique list of conversation_handles where the message type is my end of batch message ( should only be one per batch). Then I used the foreach loop construct thinking I could pass the conversation_handles around and into the data flow.
In the data flow I want to pull all of the messages at once. It looks like the receive statement is designed to do this with the concept of using a table variable.
So I built this SQL to use in for the SQL Command of my OLE DB Source. It gives me this error "Syntax error, permission violation, or other nonspecific errorr"
select top 1 @ch = conversation_handle from dm.[consultant queue] where message_type_name = 'BatchEnd' order by queuing_order;
-- select conversation_handle, message_type_name, message_body receive conversation_handle, message_type_name, message_body from dm.[consultant queue] into @messages where conversation_handle = @ch
select conversation_handle, message_type_name, message_body from @messages
I have tried sneaking the parameter into the SQL in other ways, but always get the same I have tried sneaking the parameter into the SQL in other ways, but always get the same error message. It just seems that SSIS, or OLE DB, don't want to pass parameters into a block of SQL that is executing this receive command. Has anyone else done something similar to what I am doing here? Any ideas on how to resolve this?
Obviously by using SSIS I want to work on the whole batch at once and not iterate message by message. Right now I just don't like the idea that I am getting the conversation_handle twice and possibly getting a different batch of messages to process.
I followed an example using the AdventureWorks database to set up a simple messaging test on one database:
Code Block -- We will use adventure works as the sample database USE AdventureWorks GO -- First, we need to create a message type. Note that our message type is -- very simple and allowed any type of content CREATE MESSAGE TYPE JobRequest VALIDATION = NONE GO -- Once the message type has been created, we need to create a contract -- that specifies who can send what types of messages CREATE CONTRACT JobRequestor (JobRequest SENT BY INITIATOR) GO -- The communication is between two endpoints. Thus, we need two queues to -- hold messages CREATE QUEUE RequestorQueue CREATE QUEUE ReceiverQueue GO -- Create the required services and bind them to be above created queues CREATE SERVICE Requestor ON QUEUE RequestorQueue CREATE SERVICE Receiver ON QUEUE ReceiverQueue (JobRequestor) GO -- At this point, we can begin the conversation between the two services by -- sending messages DECLARE @conversationHandle UNIQUEIDENTIFIER DECLARE @message NVARCHAR(100) BEGIN BEGIN TRANSACTION; BEGIN DIALOG @conversationHandle FROM SERVICE Requestor TO SERVICE 'Receiver' ON CONTRACT JobRequestor WITH ENCRYPTION=OFF, LIFETIME= 600; -- Send a message on the conversation SET @message = N'Hello, World'; SEND ON CONVERSATION @conversationHandle MESSAGE TYPE JobRequest (@message) COMMIT TRANSACTION END GO -- Receive a message from the queue RECEIVE CONVERT(NVARCHAR(max), message_body) AS message FROM ReceiverQueue -- Cleanup DROP SERVICE Sender DROP SERVICE Receiver DROP QUEUE SenderQueue DROP QUEUE ReceiverQueue DROP CONTRACT HelloContract DROP MESSAGE TYPE HelloMessage GO
This all works fine but if I run the section that creates the message and then copy the RECEIVE section to a new query window and execute it, nothing is returned. If I run the RECEIVE section within the same query window it returns the 'Hello World' message as expected. I am new to Service Broker and so am assuming that I am missing something obvious!!
I have set up service broker to work between two instances of SQL server with Dialog Security (implemented using certificates). The initiator queue has a activation procedure attached to process the return messages.
I'm receiving the messages from inside a SSIS package using Receive statement. Once I recive the message, I store the conversation handle, message type and message body in variables and execute the remaining ETL package based on the input.
Towards the end of the package, I send a message back to the Initiator for the same conversation to indicate sucess or failure.
Code Snippet
declare @conversation_handle UNIQUEIDENTIFIER
select @conversation_handle = <<SSIS User Variable>>;
SEND ON CONVERSATION @conversation_handle MESSAGE TYPE [/OLAP/Error] (N'<Error>My custom error</Error>');
END CONVERSATION @conversation_handle ;
The problem now is that, the initiator queue receives only the "http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog" message. I would expect it to recieve "/OLAP/Error" first and then the "EndDialog" message.
Any idea on what's happening here? Any help is appreciated.
My activation sp must be able to read of various queues.
I load a variable with the queue name that activated the sp btu i cannot get the syntax working to receive or get a conversation group of a queue name that is a variable.
I have tried:
WAITFOR
(
RECEIVE message_body, conversation_handle, message_type_name, message_sequence_number, conversation_group_id FROM @callingQueue INTO @msgTable WHERE conversation_group_id = @conversationGroup
), TIMEOUT 2000;
But i get this error:
Incorrect syntax near '@callingQueue'.
Looks like you cannot use a variable.
So i tried the following:
SELECT @SQL = N' WAITFOR
(
RECEIVE message_body, conversation_handle, message_type_name, message_sequence_number, conversation_group_id FROM @callingQueue INTO @msgTable WHERE conversation_group_id = @conversationGroup
Is there a way to get more than one file with a single ftp task in SQL 2005??
I need to get 5 files from one server. They are in two different directories is that makes any difference. Right now I have a separate task for each but would like to have one task if possible.
Hi i am trying to create a batch process then commit for all messages on the queue. The problem i am having is when i run my query (As below) I only receive the first message and the corresponding end dialog for the message although i have 2000 records sitting in the queue. It is my understanding that receive without any criteria i.e top(1) or where clause should select everything of the queue. I tried receive top(100) expecting 100 records but still only got 2 back.
Hi, My msdb grown up abnormally to 35 GB. I used :
use msdb go SELECT TOP 10 OBJECT_NAME([object_id]), * FROM sys.dm_db_partition_stats WHERE index_id IN (0,1) ORDER BY in_row_reserved_page_count DESC;
And i found queue_messages_407672500 table is occupying a lot of space.
When i tried to query : select TOP 5 * FROM queue_messages_407672500 ; I got error: Msg 208, Level 16, State 1, Line 1 Invalid object name 'queue_messages_407672500'.
Also , to clear the queued messages in msdb , i tried to use : RECEIVE TOP (1) * FROM queue_messages_407672500 ; But got the same error as above.
Please suggest , how can i shrink the msdb now, as without receving the messages i am not able to shrink it.
I am getting problem in unique row in database table, but not getting unique row because I have used Distinct keyword but not getting unique row so how can we do?
I have two table one table information another table Id. But second table in two code same but I am using distinct keyword i get some row unique but second table in two row in same code but when i am fetching row same auto_id render same id create duplicate row. But I am getting only unique row.
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 a problem using service broker, a send the message from server SSB1(initiator) and a receive this message on server SSB2(target), but I don't receive response to SSB1...
In my server SSB2 has this messages on Profiler: - This message could not be delivered because it is a duplicate. - Could not forward the message because forwarding is disabled in this SQL Server instance. - The message could not be delivered because it could not be classified. Enable broker message classification trace to see the reason for the failure.
Message from SSB1 Profiler:
- This message was dropped because it could not be dispatched on time. State: 1
alert fires, but the responsible operator does not receive notification.We area using this alert from past few months. But last week got an TempDB full and we found the error in SQL server 2012 error log. But we didn't get notification to email.But the email id is working fine because we are using same email id for all other alerts.
I understand that SQL Service Broker will RECEIVE messages in the same order of SEND, so long as the messages are on the same conversation.
I would like to accomplish queue-level ordering instead of (or in addition to) conversation-level ordering.
There is a significant business case for this level of ordering. Consider an order processing system which is specified to fulfill orders in the sequence they are received. The reason for the ordering is as follows. Suppose the process(es) that RECEIVEs from the queue is down for several hours and the messages back up in the queue. Various customers place orders throughout this period of time. If more orders are placed than there are quantity for an item, the customers who placed their orders earliest in the day ought to be the ones that receive the merchandise and the later orders should be placed on backorder.
Limited experimentation showed that SQL Server totally disregards the order in which the messages were sent (on different conversations to the same queue).
The potential solution to use the same conversation has some drawbacks:
1. Difficult to do error handling because of the way error handling works in conversations.
2. It is not possible to RECEIVE using multiple threads. (Yes, RECEIVEing on multiple threads also would reorder the messages, but the reorderings would be localized in time so this would be tolerable by a lot of applications. In other words, orders from 1:00 AM would not be mixed with orders from 9:00 AM.)
Can anyone see a good solution to this in the current version?
If there are no good solutions, it would be great if Microsoft considers adding a feature where you can declare an ordering requirement when you CREATE QUEUE. Even support for an "approximate" ordering (messages can rearrange +/- several seconds) would be helpful, but the current way which seems to totally randomize the message order is not good for certain kinds of significant applications.
I am trying to send messages between 2 different server instances. I am getting the following errors in Profiler:
"This message could not be delivered because the user with ID 0 in database ID 14 does not have permission to send to the service. Service name: 'TestService1'."
"The target service name could not be found. Ensure that the service name is specified correctly and/or the routing information has been supplied."
The scripts for object creation and messaging is following at the first server instance:
USE master GO CREATE ENDPOINT SBroker STATE = STARTED AS TCP ( LISTENER_PORT = 1212 ) FOR SERVICE_BROKER ( ENCRYPTION = DISABLED ); GO
USE Test GO CREATE QUEUE TestQueue WITH STATUS=ON
CREATE SERVICE TestService AUTHORIZATION dbo ON QUEUE TestQueue
BEGIN DIALOG CONVERSATION @dh FROM SERVICE [TestService] TO SERVICE 'TestService1','2B7CE76A-9804-46F3-9AE8-0AE59313613A' ON CONTRACT [DEFAULT] WITH ENCRYPTION = OFF;
SEND ON CONVERSATION @dh MESSAGE TYPE [DEFAULT] ('this is message1');
DECLARE @status nvarchar(1024); SELECT status = GET_TRANSMISSION_STATUS(@dh);
END CONVERSATION @dh;
on second server instance:
use master GO CREATE ENDPOINT SBroker2 STATE = STARTED AS TCP ( LISTENER_PORT = 1212 ) FOR SERVICE_BROKER ( ENCRYPTION = DISABLED ); GO
in first server, in sys.transmission_queue transmission_status is empty
Both servers in the same domain, and databases on this server has the same owner.
on both servers, select @@version: Microsoft SQL Server 2005 - 9.00.2047.00 (Intel X86) Apr 14 2006 01:12:25 Copyright (c) 1988-2005 Microsoft Corporation Developer Edition on Windows NT 5.2 (Build 3790: Service Pack 1)
Receive this error msg when trying to parse a SQL Query
.Net SqlClient Data Provider: Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
I have just finished going thru a long process getting SP2 CU3 patch installed.
The first file microsoft sent was corrupted and in turn corrupted my .NET Framework, had to run repair on the Framework before installing CU3. I am now on version 9.0.3186. I have two other boxes with the same version and do not have this problem
My understanding is that all of the patches/hotfixes since SP,1 that this problem was resolved
Any help will be greatly appreciated as I am in a very heavy development stage on this box.
I've been trying different things to "READ" the recordset from the "Message Queue". I can read it but with some weird characters. I've tried
ActiveXMessageFormatter
BinaryMessageFormatter
XMLMessageFormatter
So, far I have no luck.
MessageQueue msgQ3 = new MessageQueue("SERVERNM\" + msg.Label, false);
Message msg3 = new Message();
msg3.Formatter = new ActiveXMessageFormatter(); msg3 = msgQ3.Receive(new TimeSpan(0, 0, 30));
byte[] b = new byte[msg3.BodyStream.Length]; msg3.BodyStream.Read(b, 0, (int)msg3.BodyStream.Length); System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
returnVal = enc.GetString(b);
RESULTS: I try to convert it to String and then deserialize later but I'm getting some junk. <?xml version="1.0" encoding="utf-8" ?>
hi alli have a web application on a web server.and another windows application on another computer.there are databases on each of them.how can i send and receive data between these two applications?please reply me as soon as possibleregards
I have html files which want to store in database SQL Server with data type image. How store and receive html file from database SQL Server by ASP.NET. Data type image is pointer 16 bit to file html. So where will content of files html with their image store ? Can I help you.