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("", "database", "usuario", "password")

    If mh1.isConnected= False Then

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



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


    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?

  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 and I answered with a link to 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 and watch the video SQL & Relational Databases. The tutorial files for that video can be found here
    Peter Simpson, Erel and DonManfred like this.
  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