1. Ce site utilise des cookies. En continuant à utiliser ce site, vous acceptez l'utilisation des cookies. En savoir plus.
  2. Bonjour tout le monde ! Veillez consulter la Politique de forum pour comprendre nos règles, Merci a vous !
    Rejeter la notice

AIDE How to connect to a MySql database

Discussion dans 'Windev Mobile' créé par DirkPitt, Juil 24, 2018.

  1. DirkPitt

    DirkPitt Member

    Inscrit:
    Jan 8, 2018
    Messages:
    50
    J'aime reçus:
    16
    Hello to all

    I need a suggestion or tips.
    I have to develop an application with WdMobile to run on Android o.s.
    This application must connect the tablet to an external MySql database over the web
    and it must handle an agenda with few fields..

    Do you suggest to use the SqlManager php scripts to connect to the db?
    Other ideas? Some example?

    Thanks in advance.
    Dirk
     
    Tags:
  2. Jackson

    Jackson New Member

    Inscrit:
    Jan 19, 2018
    Messages:
    8
    J'aime reçus:
    2
    Hi. You can connect trough this code.

    ConnectionNum is int
    ConnectionNum = SQLConnect("192.168.1.100", "user", "password", "DatabaseName", "MySQL")
    IF ConnectionNum <> 0 THEN
    ToastDisplay("Connection Successfully")
    ELSE
    SQLInfo()
    Error("Connection has failed !" + CR + ...
    "Error code: " + SQL.Error + CR + SQL.MesError)
    END
    SQLDisconnect()
     
    DirkPitt apprécie ceci.
  3. DirkPitt

    DirkPitt Member

    Inscrit:
    Jan 8, 2018
    Messages:
    50
    J'aime reçus:
    16
    Hi Jackson

    Thanks for the info, but i already use this kind of connection with the database.
    We are speaking of windev mobile not about windev.
    In the past years i have used an external .net component in a program developed in Visual c# to connect
    to a database in a wireless lan, because windev mobile didn't use .net component or in those years (v18)
    it didn't have a direct connection to MySql db type like windev has.

    Thanks anyway.
    Dirk
     
  4. Jackson

    Jackson New Member

    Inscrit:
    Jan 19, 2018
    Messages:
    8
    J'aime reçus:
    2
    Hi DirkPitt
    I know we are speaking about windev mobile. Believe me or not I use this to connect into PostgreSQL from windev mobile IOS application, but from emulator on windows PC.
    I still try to find the way to use it from MAC or Iphone because .Dll can not be used from MacOS or IOS.
    So, I have same problem with IOS and PostgreSql on Wx24. If I find some way , I think it is same for all external / native not supported databases, I will send you informations.

    Best regards !
     
  5. suenodesign

    suenodesign Well-Known Member
    MEMBRE WX

    Inscrit:
    Jan 1, 2018
    Messages:
    456
    J'aime reçus:
    662
    Bonjour tout le monde.

    @

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!



    These two videos will help you.

    I tried them and its OK for me.

    1- Web Services ( Partie 1 )


    2- Web Services ( Partie 2 )


    Bon Dev
     
    DirkPitt apprécie ceci.
  6. kabeda

    kabeda Member

    Inscrit:
    Avr 23, 2018
    Messages:
    92
    J'aime reçus:
    49
    Hi,
    Connecting to a DB from outside is not recommended. If, whatever, you are sure to use this way, look about "Remote MySql".
     
  7. Jackson

    Jackson New Member

    Inscrit:
    Jan 19, 2018
    Messages:
    8
    J'aime reçus:
    2
    Thank you kabeda.
    Best regards !
     
  8. DirkPitt

    DirkPitt Member

    Inscrit:
    Jan 8, 2018
    Messages:
    50
    J'aime reçus:
    16

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!



    Thank you for the videos.
    Dirk
     
  9. Jackson

    Jackson New Member

    Inscrit:
    Jan 19, 2018
    Messages:
    8
    J'aime reçus:
    2

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!


    Thank you. This is great video.



    I watch also this video, which is also good, but webdev23 generate REST webservice with some errors in code so I have to fix it from this video and it won't work in ReadAll function.
     
    #9 Jackson, Oct 8, 2019
    Dernière édition: Oct 8, 2019
    suenodesign apprécie ceci.
  10. FIRETOX

    FIRETOX Member

    Inscrit:
    Avr 18, 2019
    Messages:
    37
    J'aime reçus:
    40
    hello

    i do this since 2001 !! with android and IOS on MySQL, SQLServer, Firebird , Oracle .......
    and the base is not directly aviable from external , but wih a webservice in php
    look here :

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!



    and you can have a maximum security with https for contacting the webservice, but in http all request a crypted and response too if you want

    best Reards
     
  11. Jackson

    Jackson New Member

    Inscrit:
    Jan 19, 2018
    Messages:
    8
    J'aime reçus:
    2
    Hello again.
    I have another problem.
    If I insert image with PgAdmin (postgresql) or Php4Admin (MySQL) I can see it from Looper Control on windev mobile.
    IF I try to save image from mobile application I see blob but can not see picture .

    My code for insert:

    clMojUser is MUSERS
    clMojUser.m_sLogin = UnicodeToAnsi(EDT_Login)
    clMojUser.m_sName = UnicodeToAnsi(EDT_Name)
    clMojUser.m_sMdp = UnicodeToAnsi(EDT_Password)
    clMojUser.m_Photo = Crypt(IMG_Photo,"",cryptNone,encodeBASE64)


    //Method 2 || We will use Method 2
    //ScreenToFile(MyWindow, "gclMojUser")
    sJSON is ANSI string = ""
    Serialize(clMojUser,sJSON,psdJSON) //We serialize our data

    //We contact the webservice via http requests at the rest
    //We need to specify the method, so we will use the variable httprequest
    //HTTPCreateForm("RESGITRATION")
    //HTTPRequest(gsAPIUrl + "users/new", "", "", sJSON, "application/json", "", "")

    MojReq is httpRequest
    MojReq..URL = gsAPIUrl +"users/new"
    MojReq.Method = httpPost
    MojReq..ContentType = "application/json"
    MojReq..Content = sJSON

    MojRep is httpResponse = HTTPSend(MojReq)

    My code for read record and display it in looper:
    maReq is httpRequest
    maRep is httpResponse
    vRestVariant est un Variant
    maReq.URL=gsAPIUrl+"USERS"
    maReq..Method = httpGet
    maRep=HTTPSend(maReq)
    SI ErreurDétectée ALORS
    Erreur(ErreurInfo(errComplet))
    SINON
    vRestVariant=JSONVersVariant(maRep.Content)
    LooperDeleteAll(LOOP_Users)

    FOR ALL ss OF vRestVariant

    LooperAddLine(LOOP_Users,ss.name,ss.login,ss.mdp,ss.IDUSERS,Uncrypt(ss.photo,"",cryptNone,encodeBASE64))
    //Ako ima foto, onda
    //Uncrypt(ss.photo,"",cryptNone,encodeBASE64))
    FIN
    FIN
    LooperDisplay(LOOP_Users,taStart)

    Please correct me.

    Thank you.
     
  12. kabeda

    kabeda Member

    Inscrit:
    Avr 23, 2018
    Messages:
    92
    J'aime reçus:
    49
    Hi,
    I advice you to open a new discussion for your new question.
     

Partager cette page

Chargement...