int tpsvrinit(int argc , char **argv)
{
/*打开数据库资源*/
if (tpopen() == -1)
{......}
else
{......}}如上server 启动成功?client 如下也成功? 就是 访问数据库有问题?if (tpinit((TPINIT *) NULL) == -1)
{
...... }
{
/*打开数据库资源*/
if (tpopen() == -1)
{......}
else
{......}}如上server 启动成功?client 如下也成功? 就是 访问数据库有问题?if (tpinit((TPINIT *) NULL) == -1)
{
...... }
2.如果成功,确保如果客户端提交事物,那么服务器端必须去掉所有的commit或tpcommit语句,否则如果客户端提交,服务器端也提交的话,将会报错。因为他将关闭数据库连接,tpabort也是一样。如下:
tpcommit() must be called after all connections associated with the caller's transaction are closed (otherwise TPEABORT is returned, the transaction is aborted and these connections are disconnected in a disorderly fashion with a TPEV_DISCONIMM event). Connections opened before tpbegin(3) or with the TPNOTRAN flag (that is, connections not in transaction mode) are not affected by calls to tpcommit() or tpabort(3).