Hi Guys,
Sorry long story:
i'm busy with an app that has a local sqlite.db and a server sqlite.db
now i wanted to do some nice stuff.
1) get (after login) the reply from server that user exist and can connect with the device
in his/her hands.
NO problem that's working.
2) when the user is autorised he/she gets more data from server.
No problem That's working too.
BUT:
1) if i do these requests (user id check and some more data) one after the other the application hangs.
example: in Main 2 lines like
getuser_id
getsomething
this resolved with a timer (see code later). for me it shouldn't be like that
2) an option within the menu "Sync from server" does not function and the app exists.
here NO error is shown in ide (unfiltered log). No error in log from http service. Nothing.
However SOMETIMES is works.
Here are some codes/logs and settings:
c3p0 properties (not changed from standard):
c3p0.maxStatements=150
c3p0.maxIdleTime=1800
c3p0.idleConnectionTestPeriod=600
c3p0.checkoutTimeout=30000
B4A ide (log not filtered)
-------------------------------------------------
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
------------------------------------------------
log from service
B4A Remote Database Connecter (version 0.9)
loading: C:\B4AORDER\config.properties
Command: query: select_UserID, took 265ms, client=192.168.178.27
Command: query: select_something, took 265ms, client=192.168.178.27
if working (sometimes it does):
Command: query: select_somethingelse, took 16ms, client=192.168.178.27
the item not working:
With the timer this is functioning.
the access to the database is not the issue neither the lines in config.properties
sql.select_UserID=SELECT Uid, AppIp FROM users WHERE Uname = ? AND AppIP = ?
sql.select_something=SELECT max(nr) FROM mytable
NOT WORKING : sql.select_somethingelse=SELECT * from myothertable
(i even tried with all the fieldnames and not * = no difference)
hope someone can tel me how to handle this.
maybe c3p0 settings i really don't know anymore.
extra: I walked though with F8 (debugmode) it is like the procedure is to quick. i get all the data. No exit. is there a way to slowdown the server request?
Thanks!
Sorry long story:
i'm busy with an app that has a local sqlite.db and a server sqlite.db
now i wanted to do some nice stuff.
1) get (after login) the reply from server that user exist and can connect with the device
in his/her hands.
NO problem that's working.
2) when the user is autorised he/she gets more data from server.
No problem That's working too.
BUT:
1) if i do these requests (user id check and some more data) one after the other the application hangs.
example: in Main 2 lines like
getuser_id
getsomething
this resolved with a timer (see code later). for me it shouldn't be like that
2) an option within the menu "Sync from server" does not function and the app exists.
here NO error is shown in ide (unfiltered log). No error in log from http service. Nothing.
However SOMETIMES is works.
Here are some codes/logs and settings:
c3p0 properties (not changed from standard):
c3p0.maxStatements=150
c3p0.maxIdleTime=1800
c3p0.idleConnectionTestPeriod=600
c3p0.checkoutTimeout=30000
B4A ide (log not filtered)
-------------------------------------------------
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
------------------------------------------------
log from service
B4A Remote Database Connecter (version 0.9)
loading: C:\B4AORDER\config.properties
Command: query: select_UserID, took 265ms, client=192.168.178.27
Command: query: select_something, took 265ms, client=192.168.178.27
if working (sometimes it does):
Command: query: select_somethingelse, took 16ms, client=192.168.178.27
B4X:
Sub GetUser_ID
Req1=1
cmd.Initialize
cmd.Name = "select_UserID"
cmd.Parameters = Array As Object(Uname,MyIpAdre)
reqManager.ExecuteQuery(cmd, 0, Null)
End Sub
Sub Getsomething
Req1=2
cmd.Initialize
cmd.Name = "select_something"
cmd.Parameters = Array As Object(Uname)
reqManager.ExecuteQuery(cmd, 0, Null)
End Sub
the item not working:
B4X:
Sub Getsomethingelse
Req1=3
Dim Ssql, dt,dt2 As String
DateTime.DateFormat = "dd-MM-yyyy"
now1 = DateTime.now
dt = DateTime.Date(now1)
Ssql="select datum from syncdata"
dt2 = SQL.ExecQuerySingleResult (Ssql)
If dt<>dt2 Then
Ssql="update syncdata set datum='" & dt & "'"
SQL.ExecNonQuery (Ssql)
x=""
cmd.Initialize
cmd.Name = "select_somethingelse"
cmd.Parameters = Array As Object(Uname)
reqManager.ExecuteQuery(cmd, 0, Null)
End If
End Sub
With the timer this is functioning.
B4X:
Sub Timer1_Tick 'here i have interval 2000 (2sec)
' Do something
TimerTotal=TimerTotal + timer1.Interval
If TimerTotal=timer1.Interval Then
GetUser_ID
End If
If TimerTotal=timer1.Interval*2 Then
' Log("Timer=2")
Getsomething
End If
If TimerTotal=timer1.Interval*3 Then
Getsomethingelse ' not functioning
End If
If TimerTotal=timer1.Interval*4 Then
timer1.Enabled=False
End If
If TimerTotal=timer1.Interval*5 Then
' Log("Timer = disabled")
End If
End Sub
the access to the database is not the issue neither the lines in config.properties
sql.select_UserID=SELECT Uid, AppIp FROM users WHERE Uname = ? AND AppIP = ?
sql.select_something=SELECT max(nr) FROM mytable
NOT WORKING : sql.select_somethingelse=SELECT * from myothertable
(i even tried with all the fieldnames and not * = no difference)
hope someone can tel me how to handle this.
maybe c3p0 settings i really don't know anymore.
extra: I walked though with F8 (debugmode) it is like the procedure is to quick. i get all the data. No exit. is there a way to slowdown the server request?
Thanks!
Last edited: