New method: SQL.InitializeAsync - Asynchronously initializes the SQL connection. This is useful when connecting to remote databases.
Usage example:
Make sure to copy the library to the internal libraries folder.
Usage example:
B4X:
#Region Project Attributes
#AdditionalJar: mysql-connector-java-5.1.27-bin
#End Region
Sub Process_Globals
Dim sql1 As SQL
End Sub
Sub AppStart (Args() As String)
sql1.InitializeAsync("sql1", "com.mysql.jdbc.Driver", _
"jdbc:mysql://localhost/example?characterEncoding=utf8", "user", "password")
StartMessageLoop 'only required in a console app
End Sub
Sub sql1_Ready (Success As Boolean)
Log(Success)
If Success = False Then
Log(LastException)
Return
End If
Dim rs As ResultSet = sql1.ExecQuery("SELECT table_name FROM information_schema.tables")
Do While rs.NextRow
Log(rs.GetString2(0))
Loop
rs.Close
End Sub
Make sure to copy the library to the internal libraries folder.