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

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
 

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
 
Upvote 0

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"
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
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"
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
 
Upvote 0
Top