Such as network or server broken down off or the database service exceptions will result in not client connect to server
So how can I determine whether the program and the state of the database connection
CodePudding user response:
Oh, see
The sqlca. Dbhandle ()
Judge whether the current connection object transaction with the database connection
The return value int
Disconnected 0
CodePudding user response:
Old problem, at present there is no good solution,,,
CodePudding user response:
Dingding!!!!!!!!!!
CodePudding user response:
refer to the second floor wag_enu response: old problem, there is no any good plan,,, No way! Pb so bad? CodePudding user response:
reference 1st floor mmbest response: oh, see The sqlca. Dbhandle () Judge whether the current connection object transaction with the database connection The return value int Disconnected 0 This will reduce the performance of the client CodePudding user response:
After perform arbitrary SQL statements (select, update, insert, delete, exec, create, drop, etc.) For the following: if the sqlCa. SqlCode=1 And (sqlCa. Sqldbcode=10005 or the sqlCa. Sqldbcode=10025 or the sqlCa. Sqldbcode=0) then //database outside disconnect End the if CodePudding user response:
YY if each sentence plus database connection disconnect judgment will affect the speed? CodePudding user response:
Basically there will not be affected, even if you don't determine whether disconnect, also need to determine whether the SQL statement failure (sqlCa. SqlCode=1) General judgment will be encapsulated into a global function of SQL statement execution, such convenient unified modifications and control CodePudding user response:
refer to 6th floor yyoinge response: after execute arbitrary SQL statements (select, update, insert, delete, exec, create, drop, etc.) For the following: C/C + + code If the sqlCa. SqlCode=1 And (sqlCa. Sqldbcode=10005 or the sqlCa. Sqldbcode=10025 or the sqlCa. Sqldbcode=0) then //database outside... That still can't judge database abnormal timeliness, only when executing SQL statements, CodePudding user response:
1/f, positive solution, CodePudding user response:
reference 5 floor qq370135415 reply: reference 1st floor mmbest response: Oh, see The sqlca. Dbhandle () Judge whether the current connection object transaction with the database connection The return value int Disconnected 0 This will reduce client performance why CodePudding user response:
The references to the tenth floor xingmz response: , 1/f, positive solutions I want is the database of the judgment rather than SQL execution fails Such as my application has been hung in the background, but if an exception occurs when database, I do not know, CodePudding user response:
PB that don't really convenient CodePudding user response:
I think it is better to take an existing data, to data if there is a return to decide