进程DB 4GL -防止过多的连接具有相同的连接名称或ip地址



如何防止使用同一用户名或ip地址进行过多连接?4GL中是否有数据库、启动参数?

有时我们有网络错误或客户端错误,许多连接在几秒钟内启动,数据库溢出,新的连接不能再启动

谢谢!

没有启动参数或其他配置选项会以这种方式限制连接。

要实现这些限制,您需要在连接启动(登录)过程中添加代码。对于交互式客户机,这是用-p startup参数指定的过程。可以通过查询_CONNECT虚拟系统表查看其他连接的userid和ip地址。像这样的内容将为您提供所需的信息:

define variable myName    as character no-undo format "x(30)".
define variable myDevice  as character no-undo format "x(30)".
define variable myLogins  as integer no-undo.
define variable myFriends as integer no-undo.
find _myConnection no-lock.
find _connect no-lock where _connect-id = _myconn-userid + 1.
assign
myName   = _connect-name
myDevice = _connect-device
.
for each _connect no-lock where _connect-usr <> ?:
if _connect-name = myName then myLogins = myLogins + 1.
if _connect-device = myDevice then myFriends = myFriends + 1.
end.
display
myName myLogins skip
myDevice myFriends skip
with
side-labels
.

用一些逻辑替换DISPLAY,以尊重您想要施加的任何限制,如果超出了这些限制,则退出会话。

最新更新