Toad World® Forums

Unique Users


#1

How can I write a BF script that launches each connection with a unique database login? For example, rather than the profile using a single ‘bfuser’ database login, I would like each connection to use its own unique login (bfuser01, bfuser02, etc)


#2

The easiest way to do this is by using BFScripts for the profile information. So if you are able to create users for your database such as bfuser1, bfuser2, etc., you could enter in the following for the username in the profile;

bfuser$BFUserID()

This will generate the bfuser1 for virtural user 1, bfuser2 for virtural user 2, and so on. The same could be done with the password field, but of course if you are creating the users just set them all to be the same password.

Now if you have a predefining set of users, let’s say SCOTT, JEFF, and STEVE. with passwords like SCOTTPWD, JEFFPWD, and STEVEPWD respectively, then you will need to create a flat file for valid username/password combinations, such as c:\users.text with the contents of;

“SCOTT”,“SCOTTPWD”
“JEFF”,“JEFFPWD”
“STEVE”,“STEVEPWD”

So with this the username and password fields of the profile would be;

$BFFileArray(“c:\users.text”,RANDOM,1)

and

$BFFileArray(“c:\users.text”,CURRENT,2)

This will randomly select a username and password combination for each virtual user.

Kevin