Service crash on SQLExec without connection

Startbeitrag von Yaku am 29.01.2016 16:08

Hi everybody,
I'm using a service that connects to an external MySQL database, and I'm trying to simulate the loss of this particular connection.
The strange thing is that whenever i try to call the function SQLExec to run a simple query (just to check if the connection is still avaliable or not), the service suddenly crashes at that precise spot, without giving SQLExec the possibility to return false.. Is that normal behaviour from it?
Here's the code that i actually run:
Query is string = "SELECT id, nickname, password FROM users WHERE nickname = '%1' AND password = '%2'"

sQuery2 is string= StringBuild(sQuery,usr,psw)
b is string="myQuery"
***IF NOT SQLExec(sQuery2,b) THEN
SQLInfo(b)
ServiceWriteEventLog("Error:"+SQL.MesError)
END


the *** indicates where the service crashes
TIA

Antworten:

Hi,

if you are using webservice that come with WD then yes it's normal . some error also not catch and return . worse part , it's very slow .

von CCC2 - am 29.01.2016 16:26
Hi CCC2,
thank you for your quick answer
I agree with you, the handling of errors in webservices could be very tricky... but actually I'm having problems with background services, which run independently as windows services AFAIK

von Yaku - am 29.01.2016 16:32
If I read well it seems he's talking about a windows service not a webservice.

By the way, I don't know how to help.. my post is only to help keeping the focus on the right issue/question :)

von StefanoG - am 29.01.2016 16:33
sorry my fault .

if it work as same when connect to webservice ,
sqlexec some error are not return . sqlexec will still return true . but crash when call SQLGetCol()

try use catch exception()

von CCC2 - am 29.01.2016 16:45
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.