Hi to all programmers.
I have a MariaDB server working in a Rasberry Pi (all Ok)
I tested the folow code to get data over Wifi from my PC in B4J and works fine.
I need port it to Android and I have problems with the connection and some libraries can ayone help me?.... Thank's a lot![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
The log Result is:
The working code in B4J its simple as....
I have a MariaDB server working in a Rasberry Pi (all Ok)
I tested the folow code to get data over Wifi from my PC in B4J and works fine.
I need port it to Android and I have problems with the connection and some libraries can ayone help me?.... Thank's a lot
The log Result is:
The working code in B4J its simple as....
Get remote data from MariaDB Server:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
'MariaDB Connector/J Driver
#AdditionalJar: mariadb-java-client-2.4.2.jar
Sub Process_Globals
Private SQL As SQL
Dim RS As ResultSet
#Region Database Location
Private DBLocation As String = "192.168.xxx.xxx:1818" '<-- IP address
Private DBUsername As String = "user" '<-- DB user name
Private DBPassword As String = "123456" '<-- DB password
Private SQLCommand As String '<-- Auxiliar string to see the text
#End Region
End Sub
Sub AppStart (Args() As String)
LogError("---------- NorthWind Database (MariaDB) ----------")
SQLCommand=$"jdbc:mariadb://${DBLocation}:3306/"$
SQL.InitializeAsync("MariaDB", "org.mariadb.jdbc.Driver",SQLCommand , DBUsername, DBPassword)
SQL.Close
StartMessageLoop 'only required in a console app
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
'Connected to MariaDB SQL Server
Sub MariaDB_Ready (Success As Boolean)
If Success Then
RS = SQL.ExecQuery("SELECT x.* FROM TabletsDB.Calibracion x")
Do While RS.NextRow
Log(RS.GetString2(0)) 'First register
Log(RS.GetString2(1))
Log(RS.GetString2(2))
Log(RS.GetString2(3))
Log(RS.GetString2(4))
Log(RS.GetString2(5))
Log(RS.GetString2(6))
Log(RS.GetString2(7)) 'Last register
Loop
RS.Close
End If
StopMessageLoop 'only required in a console app
End Sub