none
Windows Mobile 5, Pocket PC doesn't connect to SQL after certain morning hours RRS feed

  • Question

  • So we have an in-house program written in C# running on a Socket Mobile Pocket PC (SoMo650) with Windows Mobile 5. In the past few weeks the device has been VERY spotty in connecting to our SQL server database. Most mornings it works fine, but around 10:00 am (give or take half an hour) it just stops connecting completely; only working afterward on the bluest of moons. The program works fine on other computers 24/7, it's only the PPC and PPC emulators that are having problems. The next morning it starts working fine until ~10:00 am again. Here is the stack trace I get (I typed it out by hand, so sorry for any typos) :

    ProgramZ.exe
    SqlException
    
    at System.Data.SqlClient.SqlConnection.OnError()
    at System.Data.SqlClient.SqlInternalConnection.OnError()
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
    at System.Data.SqlClient.Tdsparser.Connect()
    at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin()
    at System.Data.SqlClient.SqlInternalConnection..ctor()
    at System.Data.SqlClient.SqlConnection.Open()
    at System.Data.Common.DbDataAdapter.QuietOpen()
    at System.Data.Common.DbDataAdapter.FillInternal()
    at System.Data.Common.DbDataAdapter.Fill()
    at System.Data.Common.DbDataAdapter.Fill()
    at ProgramZ.ProgramZTableAdapters.qryWarehousesTableAdapter.GetWarehouse()
    at ProgramZ.frmCollection.frmCollection_Load()
    at System.Windows.Forms.Form.OnLoad()
    at System.Windows.Forms.Form._SetVisibleNotify()
    at System.Windows.Forms.Form.set_Visible()
    at System.Windows.Forms.Application.Run()
    at ProgramZ.Program.Main()

    When debugging in Visual Studio, the error message is "SqlException was unhandled". That's it. When I click on details, I get the following info:

    [System.Data.SqlCLient.SqlException]  {"SqlException"}
    Class                                                     20
    Errors                                                    {System.Data.SqlClient.SqlErrorCollection}
    InnerException                                     null
    LineNumber                                         0
    Message                                              "SqlException"
    Number                                                6
    Procedure                                            "ConnectionOpen(Connect())."
    Server                                                   "ServerName"
    Source                                                  ".Net SqlClient Data Provider"
    StackTrace                                            "at System.Data.SqlClient.SqlConnection.OnError()"...
    State                                                      0
    

    The program is set up with a typical ADO connection. What the code is trying to do is populate a combobox with stuff from the server via a dataset; here is the code for that (located in form_load).

    try
       {
        //Get Warehouses and Locations for Comboboxes
        qryWarehousesBLL wHse = new qryWarehousesBLL();
        this.cboWarehouse.DataSource = wHse.GetqryWarehouses();
        this.cboWarehouse.DisplayMember = "MWH_WhsName";
        this.cboWarehouse.ValueMember = "MWH_WhsName";
        this.cboWarehouse.SelectedIndex = -1;
       }
    catch (Exception ex)
       {
        System.Windows.Forms.MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
        MessageBoxIcon.Exclamation,     MessageBoxDefaultButton.Button1);
       }
    

    This program was written by someone else, but I think “qryWarehousesBLL” is referring to a small class, and here is the code in that:

    private qryWarehousesTableAdapter _qryWarehousesAdapter = null;
    
     protected qryWarehousesTableAdapter Adapter
            {
                get
                {
                    if (_qryWarehousesAdapter == null) _qryWarehousesAdapter = new qryWarehousesTableAdapter();
                    return _qryWarehousesAdapter;
                }
            }
    
    [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
    public ProgramZ.ProgramZ.qryWarehousesDataTable GetqryWarehouses()
            {
                    return Adapter.GetWarehouse();
            }
    

    Where the actual code is failing is when loading up the Visual Studio-created dataset (here is the code snippet where things go wrong).

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
    public virtual ProgramZ.qryWarehousesDataTable GetWarehouse() 
    {
        this.Adapter.SelectCommand = this.CommandCollection[0];
        ProgramZ.qryWarehousesDataTable dataTable = new ProgramZ.qryWarehousesDataTable();
        this.Adapter.Fill(dataTable); // <-- this is where the error is thrown
        return dataTable;
    }
    

    Any ideas what's going on? The fact that it works in the mornings for a few hours then just stops working completely is confusing me big time. This program has been working for years until recently. The package sql.ppc.wce5.armv4i is installed on the device (that package is needed for it to connect to SQL). We've tried restarting the server, reinstalling the software, a factory reset on the PPC and reinstalling everything, and still no luck. Here's some more info on the device itself:

    Manufacture: Socket Mobile, Inc
    Product ID: SoMo650
    CPU: ARM920T PXA270
    Windows Mobile 5.0 with the Messaging and Security Feature Pack
    OS 5.1.478 (Build 15706.3.5.2

    Considering that the problem also happens with the PPC emulator in Visual Studio 2008, I doubt that info will help with anything. But there it is just in case. The device is connected via WiFi to our SqlServer 2000. There are about 5 more databases running on the server, about 3 of which are being used on a regular basis (as in multiple times a day). One of them is an ERP system that's being used by 10+ people at any given time. There's a decent amount of traffic to the server, but it seems to be handling it fine (no issues found in the Task Manager). This Pocket PC is the only device that uses the "ProgramZDatabase". I am unaware of any backups or reports that are taking place during these errors. I don’t see anything in the logs, unless I’m just looking in the wrong places. None of the configurations in the SQL server have been touched in years.

    In another forum someone mentioned that I might need to check into a connection timeout. I’m a little new to connection timeouts; is that something I should look into? How would I check and adjust the timeout? I’ve played with timeouts in the connection string, but no luck.

    Wednesday, November 11, 2015 4:47 PM

Answers

  • Yes, base on your test, I would also like to think its the problem of the environment.

    Have an idea, you can install some network capture software such as Fiddler on your server and monitor the data incoming at 10:00 am, if there is the request come from the device, that means the network and connection is good so far, you need focus on the server side also the database side.

    However I've no such experience on the server or database troubleshooting, also the forum is for discuss general  development issues related to the Windows Mobile Platform.

    I would recommend you further discuss the question at the Server forum or SQL forum:

    https://social.technet.microsoft.com/Forums/windowsserver/en-US/home?category=Windowsserver

    https://social.technet.microsoft.com/Forums/sqlserver/en-us/home?category=sqlserver

    Thanks for your understanding.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 13, 2015 9:39 AM
    Moderator

All replies

  • Hi SimplyViewing

    Well, the issue you are facing is really weird!

    >>Most mornings it works fine, but around 10:00 am (give or take half an hour) it just stops connecting completely; only working afterward on the bluest of moons.

    >>This program has been working for years until recently.

    At least we know that the code should not have any problem on functionality, but there should be some limitation on the either code part or on the SQL part or probably the configuration of the device.

    I would recommend you check following things:

    1, on the 10:00 am can your device access the internet or write a small application to test connection from device to the SQL database (the error happens as the SQLException, we should make sure if the SQLException is from device side or the SQL database side. )

    2, If the issue is on your device side, please further look into the configuration of the device, for example if the internet connection will get break at some time. Also check into the code if there is hard code limited the connection.

    3, If the issue on the SQL connection, could be the network issue, or the SQL database or even the SQL server issue, need to check into the SQL server configuration or the network configuration.

    I believe you need further troubleshooting the issue, not only on the code part, but also on the configuration of the environment.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, November 12, 2015 2:54 AM
    Moderator
  • Thanks for your response! After 10:00 am/when the PPC stops connecting to SQL, the device still has a WiFi connection and can connect to the internet. I've tried writing a small second program to test connecting to the database, and I still get the same errors at the same time. I'll try writing another program that tests another database on the same server.

    I tend to think it's a problem with the network, the SQL database, or the SQL server. I'm really confused that it works on other computers though. The network and SQL server were here long before I was hired, so any advice where I should start troubleshooting?

    Thursday, November 12, 2015 7:21 PM
  • Yes, base on your test, I would also like to think its the problem of the environment.

    Have an idea, you can install some network capture software such as Fiddler on your server and monitor the data incoming at 10:00 am, if there is the request come from the device, that means the network and connection is good so far, you need focus on the server side also the database side.

    However I've no such experience on the server or database troubleshooting, also the forum is for discuss general  development issues related to the Windows Mobile Platform.

    I would recommend you further discuss the question at the Server forum or SQL forum:

    https://social.technet.microsoft.com/Forums/windowsserver/en-US/home?category=Windowsserver

    https://social.technet.microsoft.com/Forums/sqlserver/en-us/home?category=sqlserver

    Thanks for your understanding.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 13, 2015 9:39 AM
    Moderator