I connect to a Firebird database with the following code:
Sometimes I get the following error:
What could be the cause?
Thanks.
Regards.
B4X:
Sub Process_Globals
Dim pool As ConnectionPool
Dim str_sql As String
Dim esito As String
End Sub
.......
Public Sub inizializza_pool As String
Try
If pool.IsInitialized = True Then
Return "OK"
Else
Try
pool.ClosePool
Catch
fp.scrivi_log(LastException.Message,"gestione_fdb_pool:inizializza_pool:ClosePool")
End Try
pool.Initialize("org.firebirdsql.jdbc.FBDriver",strconn_fbd,user_fdb,pwd_fdb)
If pool.IsInitialized=True Then
Return "OK"
Else
Return "KO"
End If
End If
Catch
Return "KO: " & LastException.Message
End Try
End Sub
...................................................
Private Sub verifica_presenze_pool
Try
......................
inizializza_pool
Dim sq As SQL = pool.GetConnection
'estraggo tutte le letture non trasferite con id_dipendente > 0
str_sql = "select * from ibutton where trasferito = 'N' and id_dipendente > 0 order by id"
rst = connessione_db.sql_pg.ExecQuery(str_sql)
Do While rst.NextRow=True
id_button = rst.GetInt("id")
ibutton_rom = rst.GetString("ibutton_rom")
i_timestamp = rst.GetString("i_timestamp")
direction = rst.GetString("direction")
id_dipendente = rst.GetInt("id_dipendente")
id_azienda = rst.GetInt("id_azienda")
trasf_timestamp = rst.GetString("trasf_timestamp")
Dim data_lettura As String
Dim ora_lettura As String
data_lettura = i_timestamp.SubString2(0,10)
ora_lettura = i_timestamp.SubString2(11,16)
'----------------------------------
'inserisco in presenze
'-----------------------------------
str_sql = "insert into PRESENZE (ID_AZIENDA,ID_DIP,TIPO,DATA,ORA,IBUTTON,"
str_sql = str_sql & " TRAS,ID_ORARIO,ID_IBEM,ID_TRASF_IBEM,ID_LETTURA) "
str_sql = str_sql & " values "
str_sql = str_sql & "(?,?,?,?,?,?,'S',0,?,?,?) "
sq.AddNonQueryToBatch(str_sql,Array As Object(id_azienda, _
id_dipendente,direction,data_lettura,ora_lettura, _
ibutton_rom,dichiarazioni.ID_IBEM,ID_TRASF_IBEM,id_button))
'-----------------------------------
'inserisco in presenza ibem
'-----------------------------------
str_sql = "insert into PRESENZE_IBEM (ID_AZIENDA,ID_DIP,TIPO,DATA,ORA,ID_IBEM,"
str_sql = str_sql & "ID_TRASF_IBEM,ID_LETTURA) "
str_sql = str_sql & " values "
str_sql = str_sql & "(?,?,?,?,?,?,?,?) "
sq.AddNonQueryToBatch(str_sql,Array As Object(id_azienda,id_dipendente,direction, _
data_lettura,ora_lettura,dichiarazioni.ID_IBEM,ID_TRASF_IBEM,id_button))
Loop
rst.Close
sq.ExecNonQueryBatch("inserimento_complessivo_presenze")
Catch
fp.scrivi_log(LastException.Message,"gestione_fdb_pool:verifica_presenze_pool")
End Try
End Sub
Sometimes I get the following error:
com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@15f7cbe -- timeout at awaitAvailable()
What could be the cause?
Thanks.
Regards.