question

Deepika avatar image
Deepika asked

SQL Replication error code

We are using AsyncTransPullSubscriptions and AsyncMergePullSubscriptions in VB.NET windows application to synchronize the data.We are not able to capture the exact replication error code.For ex:If the subscription is getting expired then we are getting the error code as -2147467259 which seems to be generic SQL error. Could you please suggest the possible SQL replication error code.
sqlreplication
6 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@Deepika Have you tried multiple catch blocks (one for each possible exception type) or, most importantly, interrogating the InnerException and viewing the StackTrace? All types of exceptions inherit from Exception, but sometimes it makes sense to trap them separately, i.e. to wheel out a separate catch blocks for [ReplicationAgentException][1], [ReplicationAgentContainerException][2], [OSException][3] etc. [1]: https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.replication.replicationagentexception.aspx [2]: https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.replication.replicationagentcontainerexception.aspx [3]: https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.replication.osexception.aspx
0 Likes 0 ·
@Oleg Thanks for quick response. We are getting ComErrorException when the subscription is expired for trans/merge subscription.In this case,the inner exception is nothing and the stack trace contains the below details Microsoft.SqlServer.Replication.TransSynchronizationAgent.Initialize() at Microsoft.SqlServer.Replication.TransSynchronizationAgent.Synchronize() at Sysco.SAM.BusinessLayer.CSubscription.AsyncTransPullSubscriptions() As suggested, i have included ComErrorException as separate exception but the exception details seems to be generic as that of Exception. Do we have possible SQL replication error codes and error messages?
0 Likes 0 ·
@Oleg Can you provide the possible replication error messages/error code so that we can handle those in our application. For ex:Subscription is getting failed because of the subscription expiration/retention period.
0 Likes 0 ·
@Deepika If you are getting the ComErrorException then you can try reading the value of the [ComHResult][1] property which this specific type of exception exposes. Also, the [ErrorMessage][2] property might be a bit more helpful than the Message of the Exception. Please let me know if this works. [1]: https://technet.microsoft.com/en-us/library/ms147562(v=sql.110).aspx [2]: https://technet.microsoft.com/en-us/library/ms147589(v=sql.110).aspx
0 Likes 0 ·
@Oleg ComHResult and ExceptionMessage property has the value "-2147467259" and "unspecified error" respectively and this seems to be generic SQL error. Do we have the standard replication error code and error messages in order to handle this scenario.
0 Likes 0 ·
Show more comments

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.