Thursday, March 29, 2012

General Network error even good connection and small amount of data

Hy everyone,

I have a problem at pulling data on PDA using Sql Mobile 5 from Sql Server 2000.

It work s for most tables, except for two . Every table of those two has about 1000 records and every record about 150 bytes, so all data is about 150 kbytes.

When I connect to the Sql Server 2000 through LAN, no problem. But when I connect through GPRS - VPN, the error occurs. But, the PDA- phone connection is via Bluetooth and at ping no TimeOut appears, the replies are about 600-700 ms. When connecting with a desktop computer through GPRS no such problem occurs.

So , I don't know what could be the cause: the connection or the Sql Mobile which doesn't retry enough in case of error to transfer all data .

A specialist from the GPRS provider told me to use 3G phone , but , because the GPRS phones have already been bought, this would be a too big investment. So, I don't think this is a good idea in this moment .

I found similar problem on the net and a solution was to use Pooling = False. But , in Sql Mobile there is no pulling parameter available when making the connection string .

Any help is very precious to me ,

Mihai .

Hi Mihai,

Seems like you are using a GPRS phone to act like a bluetooth modem for a PDA. This is a tested scenario, and would work :) A couple of issues i can imagine right-away:

1. From the ping round trip time of 600 ms, i guess the synchronization must be timing-out at the TCP/IP level. Below are some time-out properties (HTTP &TCP/IP) of the merge replication and RDA programming objects, which can be set to optimize synchronization over various network bandwidths.

(HTTP)

ConnectionRetryTimeout: Specifies the time, in seconds, to continue to retry sending requests after an established connection has failed.

(TCP/IP)

ConnectTimeout: Specifies the time, in milliseconds, to wait for a connection to the server.

ReceiveTimeout: Specifies the time, in milliseconds, to wait for the response to a server request.

SendTimeout: Specifies the time, in milliseconds, to wait to send a request to the server.

When data is synchronized over a cellular or mobile network, requests sent to the server, and responses from the server can time out. This occurs when a low-bandwidth connection requires too much time to transmit the data. In your case, you have an overhead of the bluetooth transport as well! These time-outs would cause synchronization to fail, which you can solve by specifying a longer time-out value. Try setting a huge value (60000 ms) in your code for the TCP/IP Connect and Send/Recieve Timeouts on the merge replication/RDA object. This mostly should solve your problem.

2. Bluetooth DUN Profile - I assume you are using the Dial-Up Networking profile for the phone to act as a GPRS modem. Are you sure there are no pairing issues? During our tests, we faced a lot of issues with the bluetooth pairing - especially between WM 5.0 PDA's and third party mobile devices.

Let me know if this works out!

Regards,

Sravanth Aluru

|||

When inserting the parameters you specify for the connection string I get an error that says "Unknown connection option ..." .

And for the SqlConnection object there are no properties like those. Only PacketSize, ConnectionTimeout .

I forgot to say previously that I put in connection string "Packet Size=512" and "ConnectionTimeout=90". I tried even with ConnectionTimeout=180. No change.

Do I miss anything, any assembly declaration ?

Could give me another advice ?

Mihai.

|||

The parameters are available in SQL Mobile 3.1 Beta which shipped with Visual Studio 2005 SP1 and onwards.

Sorry for missing this information out in my earlier response!

Can you specify which version you are on?

/Sravanth

|||

I have Sql Mobile 3.00. So , now I am downloading it . I'll reply as soon as I have news.

Thanks a lot,

Mihai.

|||

I can't get sql mobile 3.1

I just installed VS Professional, then SP1. Only Sql mobile 3.0. Anyway, in VS when I try to add reference to System.Data.Sqlclient it shows 3.0 version .

I tried to connect with SendTimeout parameter in the connection string . But I get error which says it is unknown parameter.

I even installed Sql everywhere because I saw it was 3.1 version. Nothing .

I also installed 3_SQL Server 2005 Mobile Edition Server Tools ...

I don't know what else to do.

Any suggestion ?

Thank you,

Mihai .

|||

Yes, I see. It's TCP/IP level ... sorry .

Of course I won't have those parameters in connection string. But how can I work at stream level and use the SQL commands to get data ? Everywhere in docs, when using TcpClient class, the stream is used for sending/receiving data .

But, how do I do to use these TCP/IP parameters if I work at IP level, with sql connection and then sql commands ?

Please give me some advices , I'm a rookie in working with these protocols.

Thanks a lot,

Mihai.

|||

This is a sample of how I get data:

SqlConnection s2000conn = new SqlConnection("Server=10.1.1.10 ; Connection Timeout=60 ; Packet Size = 512 ; UId=user;Pwd=pwd;Database=GestSC");

try

{

s2000conn.Open();

}

catch (SqlException eroare)

{

MessageBox.Show("Connection error", "Eroare Sql");

return;

}

SqlCommand sqlcoms = new SqlCommand();

sqlcoms.CommandText = "SELECT * FROM part ";

SqlDataAdapter da_part = new SqlDataAdapter(sqlcoms.CommandText, s2000conn);

DataSet ds_part = new DataSet();

DataTable dt_part = ds_part.Tables.Add("downpart");

da_part.Fill(ds_part, "downpart");

.....

Then I insert this data in Sql Mobile database .

But how would I use TcpClient ?

TcpClient tc = new TcpClient();

tc.SendTimeout = 90;

And then ?

Thank you ,

Mihai .

|||

Man ,

Is it that simple that it doesn't really worth the effort or you have no answer ?

Can you say smth ?

Thanks anyway,

Mihaila.

|||

Hy all,

I solved the problem by breaking the results into many smaller packets.

First I counted the total number of records and then Fill-ed the cursor with a for-end loop. Simple, but initially I wanted to work in the default mode, not to write code.

And it works.

Finally I heared from the GPRS provider that the GPRS allows small packets of data (maximum 2048 for Packet Size preffered) and the transport of data is not very reliable, so small amount of data should be transfered at one time.

Thank you anyway for all your replies,

Mihaila.

No comments:

Post a Comment