locked
Connect to a MySQL database on a WAMP server. RRS feed

  • Question

  • I have a windows mobile application written using Visual C++. 
    I need my program to connect to a WAMP server on a PC and insert/delete/edit data in a MySQL database.

    I will use my PDA to connect via wi-fi to the same network as the PC.

    Please can someone tell me how to proceed with this?  How do I begin with the comms part of this?

    Thanks
    Tuesday, August 18, 2009 1:01 PM

Answers

  • Hi LearnerMan1234,

    In fact, I have replied in your another thread, please check it. If you are working c++ native code, we have to use socket to transfer to data to PC server, PC server insert data to MySQL database.

    Windows mobile SDK provide socket sample, you can refer to it:
    D:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\SockApp


    If you have further question, please let me know.


    Best regards,
    Guang-Ming Bian - MSFT

    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Thursday, August 20, 2009 7:29 AM

All replies

  • Hi LearnerMan1234,

    In fact, I have replied in your another thread, please check it. If you are working c++ native code, we have to use socket to transfer to data to PC server, PC server insert data to MySQL database.

    Windows mobile SDK provide socket sample, you can refer to it:
    D:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\SockApp


    If you have further question, please let me know.


    Best regards,
    Guang-Ming Bian - MSFT

    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Thursday, August 20, 2009 7:29 AM
  • Hi Guang-Ming Bian,

    thanks for your response.  I have in fact used the socket method to connect from my PDA to a server which inserts data directly into my MySQL database.

    However, for this particular project it will be just WAMP installed on the users PC (Not the server program that I wrote)  so I cannot use this method.

    I must use the other method you suggested:
    "The other way is using web service to access data from mysql database and PDA access the web service to get the data"

    Could you possibly point me in the right direction on how do begin to do this.  I have been playing round with some code which downloads a webpage like so:

    HINTERNET hOpen = InternetOpen (L

    "Test", INTERNET_OPEN_TYPE_PRECONFIG,NULL, NULL, 0);

    HINTERNET hConnection = InternetConnect( hOpen, L

    "www.somewebsite.com", 80, L" ",L" ", INTERNET_SERVICE_HTTP, 0, 0 );

    HINTERNET hData = HttpOpenRequest( hConnection, L

    "GET", L"/index.php", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0 );

    HttpSendRequest( hData, NULL, 0, NULL, 0);

    while

     

    ( InternetReadFile( hData, buffer, 255, &dwRead ) )
    {
         if ( dwRead == 0 )
            return;

         buffer[dwRead] = 0;
         m_strContents += buffer;
    }

    I have no experience with web services so even a link to a good tutorial would be good.


    Thanks


    Thursday, August 20, 2009 8:05 AM
  • Hi HarryBoy123 ,

    Since you are coding in c++, it is difficult to use web method in c++, you can have a look at the thread:
    http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/b5ac893e-005e-4c30-bb91-3699e1f0ef5e/


    c++ still can access mysql, see here:
    http://forge.mysql.com/wiki/Connector_C%2B%2B

    now PDA send data via socket in c++, PC receive the data via socket in c++, and access mysql database.


    Best regards,
    Guang-Ming Bian - MSFT

    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Monday, August 24, 2009 3:48 AM