[CF 2.0 Sql Mobile 3.0] SqlCeMerge replication Problem

S

Steve B.

Hi,

I have an application that use merge replication to synchronize.

I use this code :

/// <summary>
/// Gets the recplication object
/// </summary>
protected SqlCeReplication GetReplicationObject()
{
SqlCeReplication _replication;
if(!_configured)
throw new NullReferenceException(
"You must call the Configure method before synchronizing"
);
_replication = new SqlCeReplication(); // The exception throws here
_replication.InternetUrl = _internetUrl;
_replication.Publisher = _publisher;
_replication.PublisherDatabase = _publisherDataBase;
_replication.PublisherSecurityMode = SecurityType.NTAuthentication;
_replication.Publication = _publication;
_replication.SubscriberConnectionString = BuildLocalConnectionString();
_replication.Subscriber = _subscriber;
_replication.InternetLogin = _userName;
_replication.InternetPassword = _password;
_replication.CompressionLevel = 6;
return _replication;
}

This code works well with the CF 1.1 version. Now with the CF 2.0 version
this does not work.
The line "_replication = new SqlCeReplication();" throw an exception "A sql
mobile DLL could not be loaded. Reinstall Sql Mobile. [ DLL Name =
sqlceca30.dll ]".

I actually have hard reseted the pda, deployed again the app, but the app
still does not works.

I also tryed this code in another application using the same parameters, and
that works !

So what in this application could cause the application to stop working
correctly ?

Thanks in advance,
Steve
 
S

Sigalit

What is the target device that you defined in your project, and what is the
type of the device you are actually deploying to?
If the two don't match then you could get this type of error because the
dll's that are deployed to the device are not suitable for its type.
 
S

Steve B.

All is Pocket PC 2003.
But the dll's are shared on the device. Since I have two application that
works with the replication (one app test, and one "prod" app), I don't think
the sql mobile installation is the cause of the issue.

I compared the code of both apps, and it seems to be the same parameters.

The strangest thing is that the code throw the exception at line containing
the constructor of the SqlCeReplication object. Not the sync method...

Steve

Sigalit said:
What is the target device that you defined in your project, and what is
the type of the device you are actually deploying to?
If the two don't match then you could get this type of error because the
dll's that are deployed to the device are not suitable for its type.

Steve B. said:
Hi,

I have an application that use merge replication to synchronize.

I use this code :

/// <summary>
/// Gets the recplication object
/// </summary>
protected SqlCeReplication GetReplicationObject()
{
SqlCeReplication _replication;
if(!_configured)
throw new NullReferenceException(
"You must call the Configure method before synchronizing"
);
_replication = new SqlCeReplication(); // The exception throws here
_replication.InternetUrl = _internetUrl;
_replication.Publisher = _publisher;
_replication.PublisherDatabase = _publisherDataBase;
_replication.PublisherSecurityMode = SecurityType.NTAuthentication;
_replication.Publication = _publication;
_replication.SubscriberConnectionString = BuildLocalConnectionString();
_replication.Subscriber = _subscriber;
_replication.InternetLogin = _userName;
_replication.InternetPassword = _password;
_replication.CompressionLevel = 6;
return _replication;
}

This code works well with the CF 1.1 version. Now with the CF 2.0 version
this does not work.
The line "_replication = new SqlCeReplication();" throw an exception "A
sql mobile DLL could not be loaded. Reinstall Sql Mobile. [ DLL Name =
sqlceca30.dll ]".

I actually have hard reseted the pda, deployed again the app, but the app
still does not works.

I also tryed this code in another application using the same parameters,
and that works !

So what in this application could cause the application to stop working
correctly ?

Thanks in advance,
Steve
 
S

Steve B.

I finally found a workaround, but I really think it is a bug.

If I instanciate the SqlCeReplication object at the very begining of the app
lifetime (but configuring it when I need), it works...

I found the solution after reading this article :
http://www.ureader.com/message/1079871.aspx

So I really wonder why I have to instanciate it before getting datas from
the DB...

my App looks like this :

static void Main()
{
SqlCeReplicationManager.InitReplicationEngine(); // only call new
SqlCeReplication()
Application.Run(new Form1());
}

Thanks,
Steve

Sigalit said:
What is the target device that you defined in your project, and what is
the type of the device you are actually deploying to?
If the two don't match then you could get this type of error because the
dll's that are deployed to the device are not suitable for its type.

Steve B. said:
Hi,

I have an application that use merge replication to synchronize.

I use this code :

/// <summary>
/// Gets the recplication object
/// </summary>
protected SqlCeReplication GetReplicationObject()
{
SqlCeReplication _replication;
if(!_configured)
throw new NullReferenceException(
"You must call the Configure method before synchronizing"
);
_replication = new SqlCeReplication(); // The exception throws here
_replication.InternetUrl = _internetUrl;
_replication.Publisher = _publisher;
_replication.PublisherDatabase = _publisherDataBase;
_replication.PublisherSecurityMode = SecurityType.NTAuthentication;
_replication.Publication = _publication;
_replication.SubscriberConnectionString = BuildLocalConnectionString();
_replication.Subscriber = _subscriber;
_replication.InternetLogin = _userName;
_replication.InternetPassword = _password;
_replication.CompressionLevel = 6;
return _replication;
}

This code works well with the CF 1.1 version. Now with the CF 2.0 version
this does not work.
The line "_replication = new SqlCeReplication();" throw an exception "A
sql mobile DLL could not be loaded. Reinstall Sql Mobile. [ DLL Name =
sqlceca30.dll ]".

I actually have hard reseted the pda, deployed again the app, but the app
still does not works.

I also tryed this code in another application using the same parameters,
and that works !

So what in this application could cause the application to stop working
correctly ?

Thanks in advance,
Steve
 
S

Syed N. Yousuf [MS]

Have you tested on another device ?
It is not a SQL Mobile bug. This sounds like a "DLL squeeze" issue where
a DLL in unable to load due to low virtual address space.

You may want to review the following KB article:
http://support.microsoft.com/kb/326164/en-us

Thank you!
Syed N. Yousuf
Microsoft Developer Support Professional

This posting is provided "AS IS" with no warranties, and confers no rights.
 
L

Lonifasiko

Have you tried uninstalling all SQL Mobile 2005 related programs for
your PPC, using Settings-->Remove programs?

Then deploy again the application and Visual Studio will install all
necessary SQL Mobile software for you.

What about the server-side installation? Is it correct?

My current replication code:

public SqlCeReplication replicationManager = null; // declared in the
form

replicationManager = new
SqlCeReplication(nvcReplication["PublicationURL"], "", "",
nvcReplication["Publisher"], nvcReplication["PublisherDatabase"],
nvcReplication["PublicationName"], userId, connectionString); // done
everytime I need to replicate

If you have not success, try posting here:

http://groups.google.es/group/microsoft.public.sqlserver.replication?lnk=li

Good luck!
 
S

Steve B.

I used the dumpmem utility and found something. We used two applications.
one is the "prod" application, and the second is a test application used for
unit testing. Both applications use exactly same parameters for the
replication.

dumpmem.txt file is slightly different for the two files, and below is part
of these files :

dumpmemTest.txt for our testing app :

TestApplication2005.exe base address: 2C000000
=========================
sqlceoledb30.dll 007F0000 34000 A, C
sqlceqp30.dll 00830000 D6000 A, C
sqlcese30.dll 00910000 67000 A, C
sqlceer30en.dll 00980000 24000 A, C
sqlceca30.dll 009B0000 6F000 A, C
sqlceme30.dll 00A20000 F000 A, C
netcfagl2_0.dll 00A30000 3E000 A, C
mscoree2_0.dll 00A70000 D1000 A, C
.... other dlls that are exactly the same for both apps ...

dumpmemProd.txt for our "prod" app :

Prod.exe base address: 2C000000
=========================
sqlceqp30.dll 00830000 D6000 A, C
sqlcese30.dll 00910000 67000 A, C
sqlceer30en.dll 00980000 24000 A, C
sqlceca30.dll 009B0000 6F000 A, C
sqlceme30.dll 00A20000 F000 A, C
netcfagl2_0.dll 00A30000 3E000 A, C
mscoree2_0.dll 00A70000 D1000 A, C
.... other dlls that are exactly the same for both apps ...

As you can see, there is a line that is not present on both apps :
sqlceoledb30.dll 007F0000 34000 A, C

The expected prod application lifetime looks like this :
SqlCeReplication constructor
Reading/writing data to the db using the same shared connection
SqlCeReplication configuration
SqlCeReplication.SyncDataBase()
Reading/Writing data to the db using the same shared connection

I needed to call the constructor of SqlCeReplication at the very begining of
the application. If not, I got "A sql mobile DLL could not be loaded.
Reinstall Sql Mobile. [ DLL Name = sqlceca30.dll ]" (my first thread).

I don't know how to interprete this results, I thank in advance anyone who
could help me...

Thanks,
Steve
 
Top