B4J Question [Solved]B4J App, runs OK in windows, error in Ubuntu

incendio

Well-Known Member
Licensed User
Longtime User
Hello guys,

I have this non ui B4J program
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
    #CommandLineArgs:
    #MergeLibraries: True
#End Region
#AdditionalJar : jaybird-full-3.0.2.jar

Sub Process_Globals
    Private dbpool As ConnectionPool
    Private Sq,ExecQ1,ExecQ2 As SQL
    Private RS As ResultSet
    Private Tm As Timer
End Sub

Sub AppStart (Args() As String)
    dbpool.Initialize( "org.firebirdsql.jdbc.FBDriver","jdbc:firebirdsql://localhost:3050/my_db?charSet=utf-8","user","pass")
    Tm.Initialize("TM",10000)
    Tm.Enabled = True
    StartMessageLoop
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


Sub TM_Tick
    Private Id As Int
    Private Val As String
    Tm.Enabled = False
    Try
        Sq        = dbpool.GetConnection
        ExecQ1 = dbpool.GetConnection
        ExecQ2 = dbpool.GetConnection
        RS        = Sq.ExecQuery("SELECT ID, VAL from snc_log where snc = 0")

        ExecQ1.BeginTransaction
        ExecQ2.BeginTransaction

        Do While RS.NextRow
            Id  = RS.GetInt("ID")
            Val = RS.GetString("VAL")
            Log(Id)
            ExecQ1.ExecNonQuery2("update or insert into rcv(id,val) values(?,?)",Array As Object(Id,Val))
            ExecQ2.ExecNonQuery("update snc_log set snc = 1 where id = " & Id)
        Loop
        ExecQ1.TransactionSuccessful
        ExecQ2.TransactionSuccessful
        RS.Close
    Catch
        Log(LastException)
    End Try
    Sq.Close
    ExecQ1.Close
    ExecQ2.Close
    Tm.Enabled = True
End Sub

On windows, App runs OK, but on Ubuntu server , raised an error

Oct 31, 2017 11:58:31 AM com.mchange.v2.log.MLog
INFO: MLog clients using java 1.4+ standard logging.
Oct 31, 2017 11:58:31 AM com.mchange.v2.c3p0.C3P0Registry
INFO: Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
Oct 31, 2017 11:58:41 AM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 20000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> z8kfsx9rvaohzz1xhju50|4b9af9a9, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> org.firebirdsql.jdbc.FBDriver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> z8kfsx9rvaohzz1xhju50|4b9af9a9, idleConnectionTestPeriod -> 600, initialPoolSize -> 3, jdbcUrl -> jdbc:firebirdsql://localhost:3050/my_db?charSet=utf-8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 1800, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 150, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]

WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@1bc6a36e is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
(TimeoutException) com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@1bc6a36e -- timeout at awaitAvailable()


The only different is the Java version.
On Windows java 1.8.0_92, on Ubuntu java 1.8.0_151.

I doubt that this is the caused.

Anyone has an idea, what's going wrong?
 
Last edited:

incendio

Well-Known Member
Licensed User
Longtime User
Thanks for your replied. Just found the solution !

I am using Firebird 3.02 on Ubuntu Server 16.

This is the solution for anybody in case have a same problem.
1) Edit firebird.conf -> sudo nano /etc/firebird/3.0/firebird.conf
2) Locate the line #WireCrypt = Enabled (for client) / Required (for server)
3) Change to WireCrypt = Enabled
4) restart firebird service or reboot the server

Should works OK now.
 
Upvote 0
Top