Not able to configure SQL Replication between Ravendb and SQL Server.

115 zobrazení
Přeskočit na první nepřečtenou zprávu

Aman Ankit

nepřečteno,
20. 10. 2014 8:26:0720.10.14
komu: rav...@googlegroups.com

Hello Oren,

I am trying to setup SQL bundle replication between Ravendb and SQL Server as per below URL.


Everything is got setup but data is not getting loaded to SQL Server. 

I have even tried moving replication DLL files as per below URL but nothing worked. Please help me out.

Regards,
Aman Ankit

Oren Eini (Ayende Rahien)

nepřečteno,
20. 10. 2014 8:51:4020.10.14
komu: ravendb
What build are you using?
Please post the sql replication document.
Check the log for any errors.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aman Ankit

nepřečteno,
20. 10. 2014 10:03:3520.10.14
komu: rav...@googlegroups.com

First thing i would like to mention here is i am new to ravendb working from last 2 days. so i might miss silly things.

Build version is 2.5.2935 

Replication script:-

Var User = {
 Id: documentId,
 FirstName: this.FirstName,
 LastName: this.LastName,
 Email: this.Email,
 };
 
 replicateTousers(user);
 
 for (var i=0; i<this.UserRoles.length;i++) {
 var role = {
   UserId: documentId,
   UserRole: this.UserRoles[i]
   };
   replicateToUserRole(role);
   }

Connection string- 
Data Source=DBA002-LT;Initial Catalog=RavendbReplicationTest;Integrated Security=SSPI;

sqlprovider- System.Data.Sqlclient

-I have also mapped SQL Replication tables.
- Create two tables in SQL Server.

-I have also moved dll files from bundles to server->plugins to get this working but it didn't worked.

- Don't see anything in Replication Statistics.

- Error in logs-

Document with key 'Raven/Alerts' was found, etag: 01000000-0000-0005-0000-000000000002
Issuing query on index Raven/DocumentsByEntityName for: Tag:Users
Document with key 'Raven/Alerts' was found, etag: 01000000-0000-0005-0000-000000000002
No work was found, workerWorkCounter: 0, for: Sql Replication, will wait for additional work
Document with key 'Raven/SqlReplication/Status' was found, etag: 01000000-0000-0005-0000-000000000003

Paul Hinett

nepřečteno,
20. 10. 2014 10:08:2820.10.14
komu: rav...@googlegroups.com

Your variable name is ‘User’, however you are referencing ‘user’…unless this is a type on the email?

Zpráva byla smazána

Aman Ankit

nepřečteno,
20. 10. 2014 10:16:5920.10.14
komu: rav...@googlegroups.com
Hi Paul,

What needs to be done. Am i missing something?

Paul Hinett

nepřečteno,
20. 10. 2014 10:24:2320.10.14
komu: rav...@googlegroups.com

You currently have:

 

Var User = {

Id: documentId,

FirstName: this.FirstName,

LastName: this.LastName,

Email: this.Email,

};

 replicateTousers(user);

 

If this is a copy+paste directly from your sql script then the this would be invalid javascript…it would need to be:

 

var user = {

Id: documentId,

FirstName: this.FirstName,

LastName: this.LastName,

Email: this.Email,

};

 replicateTousers(user);

 

Paul

Aman Ankit

nepřečteno,
20. 10. 2014 10:31:2220.10.14
komu: rav...@googlegroups.com
Thanks Paul.

I am correcting some old statement posted by me.

The build is actually 2916, Version is 2.5.0/ 6dce79a

Aman Ankit

nepřečteno,
21. 10. 2014 7:06:3221.10.14
komu: rav...@googlegroups.com
Hi Paul,

I have installed latest build 2935 but still replication is not getting configured.

Getting error as :-Could not parse SQL Replication script for UsersReplication

Raven.Database.Json.ParseException: Could not parse script ---> Jint.JintException: An unexpected error occured while parsing the script ---> Jint.JintException: no viable alternative at input '}' at line 9:1 at Jint.JintEngine.Compile(String source, Boolean debugInformation) in c:\Work\ravendb-2.5\SharedLibs\Sources\jint-22024d8a6e7a\Jint\JintEngine.cs:line 71.

Please help me out. I have been struggling from last 2 days. If possible give reference for some URL.

Regards,
Aman Ankit

Paul Hinett

nepřečteno,
21. 10. 2014 8:17:3121.10.14
komu: rav...@googlegroups.com

Can you copy+paste your full sql replication script here?

Aman Ankit

nepřečteno,
21. 10. 2014 8:31:0521.10.14
komu: rav...@googlegroups.com
  Hi Paul,

  Please find the details below and i have also attached 3 screen shot here.

Steps taken below are:-

1. Created database "Replication" In Ravendb
2. Created two documents in Ravendb
3. below Script used for replication:-

var user ={
Id: documentId,
FirstName:this.FirstName,
LastName:this.LastName,
Email:this.Email,
};

replicateTousers(user);
  
  for (var i=0; i<this.UserRoles.length; i++) {
  var role = {
     UserId: documentId,
UserRole: this.UserRoles[i]
};
replicatetoUserRoles(role);
}
  
  replicateToUserRoles(role);

Please let me know in case further information required from my side.

Thanks in advance!!

Regards,
Aman Ankit
Replication.PNG
SQL Server.PNG
Document created.PNG

Oren Eini (Ayende Rahien)

nepřečteno,
21. 10. 2014 9:48:2021.10.14
komu: ravendb
To start with, use something like (http://jsbeautifier.org/) to beautify your code, it is very hard to read otherwise.

var user = {
    Id: documentId,
    FirstName: this.FirstName,
    LastName: this.LastName,
    Email: this.Email,
};

replicateTousers(user);

for (var i = 0; i < this.UserRoles.length; i++) {
    var role = {
        UserId: documentId,
        UserRole: this.UserRoles[i]
    };
    replicatetoUserRoles(role);
}

replicateToUserRoles(role);

Note that you have replicateToUserRoles outside the loop

Paul Hinett

nepřečteno,
21. 10. 2014 9:55:2821.10.14
komu: rav...@googlegroups.com

I think there was a couple of issues, firstly the casing on some of your statements was wrong, and also you have replicateToUserRoles in there twice by the looks of it, it only needs to be inside the for loop, you had one outside the for loop at the end of your script.

 

Here is a modified script, this *should* work.

 

var user = {

Id: documentId,

FirstName:this.FirstName,

LastName:this.LastName,

Email:this.Email

};

 

replicateToUsers(user);

  

  for (var i=0; i<this.UserRoles.length; i++) {

            var role = {

                        UserId: documentId,

                        UserRole: this.UserRoles[i]

            };

            replicateToUserRoles(role);

Aman Ankit

nepřečteno,
22. 10. 2014 7:34:0322.10.14
komu: rav...@googlegroups.com
Thanks Paul. It has worked like a charm.
Odpovědět všem
Odpověď autorovi
Přeposlat
0 nových zpráv