Android Question Because my apk can not connect my mysql server when I compile in (Release) mode

Discussion in 'Android Questions' started by Julio Montilla, Sep 6, 2018.

  1. Julio Montilla

    Julio Montilla Member Licensed User

    I am using the version of b4a 5.80


    My code


    Sub Process_Globals

    Dim mh1 As MysqlHandler
    Dim rs1 As ResultSet

    End Sub

    Sub conectar


    mh1.Initialize("50.62.161.40", "database", "usuario", "password")

    If mh1.isConnected= False Then

    Msgbox("Connection error", "Conexión")
    ExitApplication

    Return

    Else

    'Msgbox("Successful Connection", "Conexion")

    Return

    End If


    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    1. Please use [code]code here...[/code] tags when posting code.

    2. You should check the logs and post the error message.
     
  3. Julio Montilla

    Julio Montilla Member Licensed User

    I was able to solve the connection problem, I'm using MysqlHandler and
    the way to solve it was by setting <uses-sdk android: minSdkVersion = "4" android: targetSdkVersion = "4" /> although I'm not happy because I do not see the reason why I have to set targetSdkVersion = "4"

    Do you think I can clarify if I can use the mysql library with MysqlHandler?

    Ty
     
  4. Julio Montilla

    Julio Montilla Member Licensed User

    the problem is that when i put it on android: targetSdkVersion = "26" /> the program does not establish the connection with my mysql server "Connection error"
     
  5. OliverA

    OliverA Well-Known Member Licensed User

    You do realize you are using a library that is over 5 years old and has not been updated since then. It is not a standard library that comes with B4A, it is a user contributed library. So yeah, with such an old library, targetSdkVersion = "4" may be necessary.

    You had a similar question/issue in this thread https://www.b4x.com/android/forum/threads/i-can-not-connect-to-the-mysql-library.96947/#post-611505 and I answered with a link to https://www.b4x.com/android/forum/threads/jdbcsql-directly-connect-to-remote-databases.84016/. That link provides you with the latest library for Android that allows you to connect to remote databases. Please read the first post in that thread with real care, since it has tips on what DB library java versions you should be using. You may also want to check out https://www.b4x.com/etp.html and watch the video SQL & Relational Databases. The tutorial files for that video can be found here https://www.b4x.com/android/forum/t...ming-video-tutorials.88787/page-2#post-577932
     
    Peter Simpson, Erel and DonManfred like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice