B4J Code Snippet Connecting to Firebird using JayBird 3.0.11

Hi, Everyone for all of you that want to connect to Firebird 2.1 here is my code and is 100% functional (Your JayBird version has to be compatible with your java version) in my case Java 8
I have a very hard time using this version it came with two files jaybird-3.0.11.jar and jaybird-full-3.0.11.jar. I started with the regular one with no success, however using the full version, it works like a charm

Sample Program:
'Non-UI application (console / server application)
#Region Project Attributes
    #CommandLineArgs:
    #MergeLibraries: True
#End Region
    #CommandLineArgs:
    #MergeLibraries: True
    #additionaljar:jaybird-full-3.0.11.jar
Sub Process_Globals
    Private SQL As SQL
End Sub

Sub AppStart (Args() As String)
    
    Private FBUsername As String = "SYSDBA"
    Private FBPassword As String = "masterkey"
    SQL.InitializeAsync("FireBirdDB","org.firebirdsql.jdbc.FBDriver","jdbc:firebirdsql://192.168.1.10:3050/C:/sistema/prolacsa.FDB?encoding=WIN1254", FBUsername, FBPassword)
    StartMessageLoop
    
End Sub
Sub FireBirdDB_Ready (Success As Boolean)
    If Success Then
        Dim RS As ResultSet = SQL.ExecQuery("SELECT CADENA_DESCRIPCION FROM cadenas")
        Do While RS.NextRow
            Log(RS.GetString2(0))
        Loop
        RS.Close
    End If
    StopMessageLoop 'only required in a console app
    SQL.Close
End Sub
 

amorosik

Well-Known Member
Licensed User
Hi, Everyone for all of you that want to connect to Firebird 2.1 here is my code and is 100% functional (Your JayBird version has to be compatible with your java version) in my case Java 8
I have a very hard time using this version it came with two files jaybird-3.0.11.jar and jaybird-full-3.0.11.jar. I started with the regular one with no success, however using the full version, it works like a charm

Sample Program:
'Non-UI application (console / server application)
#Region Project Attributes
    #CommandLineArgs:
    #MergeLibraries: True
#End Region
    #CommandLineArgs:
    #MergeLibraries: True
    #additionaljar:jaybird-full-3.0.11.jar
Sub Process_Globals
    Private SQL As SQL
End Sub

Sub AppStart (Args() As String)
  
    Private FBUsername As String = "SYSDBA"
    Private FBPassword As String = "masterkey"
    SQL.InitializeAsync("FireBirdDB","org.firebirdsql.jdbc.FBDriver","jdbc:firebirdsql://192.168.1.10:3050/C:/sistema/prolacsa.FDB?encoding=WIN1254", FBUsername, FBPassword)
    StartMessageLoop
  
End Sub
Sub FireBirdDB_Ready (Success As Boolean)
    If Success Then
        Dim RS As ResultSet = SQL.ExecQuery("SELECT CADENA_DESCRIPCION FROM cadenas")
        Do While RS.NextRow
            Log(RS.GetString2(0))
        Loop
        RS.Close
    End If
    StopMessageLoop 'only required in a console app
    SQL.Close
End Sub


Firebird 2.1 ?
For Firebird 3.0 we use
#AdditionalJar: jaybird-full-4.0.0.java8.jar
(with B4J 9.10, jdk-11.0.1)
We are waiting for someone to confirm what to use for Firebird 4.0
 
Top