#Region Project Attributes
#ApplicationLabel: SQL
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
'MySQL Connector/J Driver
#AdditionalJar: mysql-connector-java-5.1.47-bin.jar
'MSSQL Connector/J Driver
#AdditionalJar: jtds-1.3.1.jar
'FIREBIRD Connector/J Driver
#AdditionalJar: Jaybird_2_2_12.aar
#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.
Dim MYSQL As SD_SQL
Private MSLocation As String = "address"
Private MSUsername As String = "User"
Private MSPassword As String = "Password"
Dim MSSQL As SD_SQL
Private MyLocation As String = "address"
Private MyUsername As String = "User"
Private MyPassword As String = "Password"
Dim FBSQL As SD_SQL
Private FBUsername As String = "SYSDBA"
Private FBPassword As String = "masterkey"
Private driver As String = "org.firebirdsql.jdbc.FBDriver"
Private jdbcUrl As String = "jdbc:firebirdsql://192.168.1.1:3050/C:/FIREBIRD_DATA/CIUCCIA_MARIUCCIA.FDB"
Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private ListViewMs As ListView
Private ListViewMy As ListView
Private ListViewFirebird As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1")
' Log("---------- NorthWind Database (MSSQL) ----------")
' MSSQL.Initialize(Me,"MSSQL","net.sourceforge.jtds.jdbc.Driver", $"jdbc:jtds:sqlserver://${MSLocation}/test"$, MSUsername, MSPassword)
' Sleep(100)
' Log("---------- NorthWind Database (MySQL) ----------")
' MYSQL.Initialize(Me,"MYSQL", "com.mysql.jdbc.Driver", $"jdbc:mysql://${MyLocation}/register_Northwind_MySQL?useSSL=false"$, MyUsername, MyPassword)
' Sleep(100)
Log("---------- Firebird Database (MySQL) ----------")
FBSQL.Initialize(Me,"FBSQL", driver,jdbcUrl, FBUsername, FBPassword)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
'Connected to MySQL Server
Sub MYSQL_Ready (Success As Boolean)
ListViewMy.SingleLineLayout.Label.TextColor=Colors.Black
ListViewMy.SingleLineLayout.Label.Textsize=13
ListViewMy.Clear
If Success Then
Dim RS As SD_ResultSet = MYSQL.ExecQuery("SHOW TABLES")
Do While RS.NextRow
ListViewMy.AddSingleLine(RS.GetString2(0))
Loop
RS.Close
End If
End Sub
'Connected to MS SQL Server
Sub MSSQL_Ready (Success As Boolean)
ListViewMs.SingleLineLayout.Label.TextColor=Colors.Black
ListViewMs.SingleLineLayout.Label.Textsize=13
ListViewMs.Clear
If Success Then
Dim RS As SD_ResultSet = MSSQL.ExecQuery("SELECT * FROM SYS.TABLES")
Do While RS.NextRow
ListViewMs.AddSingleLine(RS.GetString2(0))
Loop
End If
End Sub
'Connected to FIREBIRD Server
Sub FBSQL_Ready (Success As Boolean)
ListViewFirebird.SingleLineLayout.Label.TextColor=Colors.Black
ListViewFirebird.SingleLineLayout.Label.Textsize=13
ListViewFirebird.Clear
Dim count As Long
If Success Then
Dim RS As SD_ResultSet = FBSQL.ExecQuery("SELECT CODICE_INTERNO, DESCRIZIONE from ARTICOLI")
Do While RS.NextRow
count=count+1
If count>100 Then Exit
Log("Count = " & count & " " & RS.GetString2(0) & " " & RS.GetString2(1))
ListViewFirebird.AddSingleLine(RS.GetString2(0)& " " & RS.GetString2(1))
Loop
End If
End Sub