但是接下来:
DBHandle returns a valid handle only if you are connected to the database. It is not able to determine if the database connection does not exist or has been lost.
也就是说我在调用connect using sqlca;
以后数据库正常连接上了。之后如果数据库端主动断开了连接(或者网络断了),在这些情况下DBHandle()的返回值仍旧是合法的,他不能判断数据库连接是否真的存在。
那么要判断数据库连接是否真的可用该怎么判断呢?
Reports the handle for your DBMS.
Return value:
Long. Returns the handle for your DBMS. Transactionobject must exist, and the database must be connected. If transactionobject exists but the database is not connected, DBHandle returns 0. If transactionobject does not exist, an execution error occurs. If transactionobject is NULL, DBHandle returns NULL.