Hello, I try to connect to a Mysql Database i follow the tutorial here:, but i always have the same error:
I can connect to my database with my pc and the my sql workbench, so i thinks the loging from outside is ok
I add in the manifest
If anybody can help me to connect
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
'#AdditionalJar: mysql-connector-java-8.0.26.jar
'#AdditionalJar: mysql-connector-java-8.0.27.jar
#AdditionalJar: mysql-connector-java-5.1.34-bin
'#AdditionalJar: mysql-connector-java-5.1.22-bin
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Public mysql As JdbcSQL
Private driver As String = "com.mysql.jdbc.Driver"
Private jdbcUrl As String = "jdbc:mysql://vpsxxxxx.ovh.net:3306/Android?characterEncoding=utf8&autoReconnect=true&useTimezone=true&&serverTimezone=UTC&Pooling=True"
Private Username As String = "admin"
Private Password As String = "xxxxxxx"
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private Button_OK As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
mysql.InitializeAsync("mysql", driver, jdbcUrl, Username, Password)
Wait For MySQL_Ready (Success As Boolean)
If Success = False Then
Log("Check unfiltered logs for JDBC errors.")
End If
' Return Success
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
I can connect to my database with my pc and the my sql workbench, so i thinks the loging from outside is ok
I add in the manifest
B4X:
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.ACCESS_NETWORK_S TATE")
If anybody can help me to connect