Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
unsigned int db_string_ping_server( SQLCA * sqlca, char * connect_string, unsigned int connect_to_db );
sqlca 指向 SQLCA 结构的指针。
connect_string connect_string 是一个常规连接字符串,它可能包含服务器和数据库信息,也可能不包含。
connect_to_db 如果 connect_to_db 为非零值 (TRUE),此函数会尝试连接到服务器上的数据库。只有在连接字符串足以连接到指定服务器上的指定数据库时,才返回 TRUE。
如果 connect_to_db 为零,此函数只尝试定位服务器。只有在连接字符串足以定位服务器时,才返回 TRUE。它不尝试连接到数据库。
如果已成功定位服务器或数据库则返回 TRUE (非零);否则返回 FALSE (零)。在 SQLCA 中返回关于定位服务器或数据库的错误消息。
此函数可用于确定是否能找到服务器,也可确定是否可成功连接到数据库。