Advantage 数据库服务器管理 API AdsMgKillUser 无法正常工作?
我在 Delphi 5.0 中编写了一个实用程序,使用 AdsMgKillUser 断开 ADS v6.2 中崩溃的连接,该实用程序在客户的服务器上运行多年。客户最近升级到 ADS v9.1 和 2008 Server:旧实用程序停止工作。将程序更新为 Delphi 7、ADS v9.1 TDataSet 和 ACE。使用从 AdsMgKillUser 帮助主题中几乎逐字复制的代码,针对 ADS 10.1 服务器进行测试,代码无法断开用户连接(但在调用 AdsMgKillUser 时我收到 AE_SUCCESS 返回代码)。 ARC32 v9.1 在断开 ADS 10.i 用户连接的同一测试中运行良好。
代码片段:
// program resides on same server as ADS
ulRetVal := ACE.AdsMgConnect( PAnsiChar(appdir), nil, nil, @hMgmtHandle );
if ( ulRetVal <> AE_SUCCESS ) then
begin
Application.MessageBox( 'Could not connect to server.', 'Connection Error', ID_OK );
exit;
end;
// strUserConn assigned connection name in format domain\username e.g. "MYSERVER\Fred"
ulRetVal := ACE.AdsMgKillUser( hMgmtHandle, PAnsiChar(strUserOrConn), 0);
if ( ulRetVal <> AE_SUCCESS )
then Application.MessageBox( 'User not disconnected.','Error', ID_OK )
else Application.MessageBox( 'User disconnected OK','Information', ID_OK );
我做错了什么?
I wrote a utility in Delphi 5.0 to disconnect crashed connections in ADS v6.2 using AdsMgKillUser that worked well for many years on a customer's server. Customer recently upgraded to ADS v9.1 and 2008 Server: the old utility stopped working. Updated program to Delphi 7, ADS v9.1 TDataSet and ACE. Using code copied almost verbatim from the AdsMgKillUser help topic, testing against an ADS 10.1 server, code fails to disconnect user, (but I get an AE_SUCCESS return code when calling AdsMgKillUser). ARC32 v9.1 works fine on the same test to disconnect an ADS 10.i user.
Code Snippet:
// program resides on same server as ADS
ulRetVal := ACE.AdsMgConnect( PAnsiChar(appdir), nil, nil, @hMgmtHandle );
if ( ulRetVal <> AE_SUCCESS ) then
begin
Application.MessageBox( 'Could not connect to server.', 'Connection Error', ID_OK );
exit;
end;
// strUserConn assigned connection name in format domain\username e.g. "MYSERVER\Fred"
ulRetVal := ACE.AdsMgKillUser( hMgmtHandle, PAnsiChar(strUserOrConn), 0);
if ( ulRetVal <> AE_SUCCESS )
then Application.MessageBox( 'User not disconnected.','Error', ID_OK )
else Application.MessageBox( 'User disconnected OK','Information', ID_OK );
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论