Gossamer Forum
Home : Products : DBMan SQL : Discussion :

random connection

Quote Reply
random connection
My host allows 3 accounts per MySQL database and I was wondering how I could randomly connect to those accounts to prevent reaching the query limit on any of those accounts. Each of them have a limit of 96,000 queries per hour (if I remember right), but I just want to make sure I don't reach that.

All 3 accounts are different username, but all the same password. I just don't know the right syntax to make it use one of the usernames randomly.
Thanks in advance for any help. Smile


DBMan SQL Version 1 mods available at:
http://dbmansqlmods.rainbowroomies.com
(Mods based on JPDeni's original mods.)
Quote Reply
Re: [shann123] random connection In reply to
OK.. I ended up figuring this problem out for myself... as with almost everything else for some reason.....

If interested, use this in place of the original @db_connect

my @array = qw/username1 username2 username3/; #space between each username
my $username = @array[rand @array];
@db_connect = ("DBI:mysql:dbname:servername","$username","password"); # password needs to be the same for each account for this to work.

Also, I got used to being able to see login error logs with my old htaccess password protection. I can't do that with dbman and wondering if anyone has any suggestions?
Since I've had to do most of it myself, I'll probably end up having to figure out a mod that will write to an error table for each failed attempt at logging in, but if anyone already has something like that, I'd really like to to see it! :-)


DBMan SQL Version 1 mods available at:
http://dbmansqlmods.rainbowroomies.com
(Mods based on JPDeni's original mods.)