dynamically created session and database : cannot avoid login prompt - fine with default session

Help!

I need to create unique sessions (and databases) for multi-threading
purposes. Everything works fine except that when I open a dataset (a TQuery
in this case) I am always prompted for a password. This doesn't happen if I
ignore the threading issue and only use the defualt session. what's
happening?!?!!! It seems that I'm not setting up the session right but I
can't see where.

Here's the code for setting up a new session and database :

var
sess : TSession;
   db : TDatabase;
begin
      try
      sess:=TSession.create(nil);
      sess.sessionname:='session'+inttostr(uniqueNumberFactory.getNumber);
      sess.keepconnections:=true;
      sess.active:=true;
      db:=TDatabase.create(nil);
  db.sessionname:=sess.sessionname;
      db.aliasname:=Alias;

db.databasename:=Alias;//'database'+inttostr(uniqueNumberFactory.getNumber);
      db.params.add('UID='+userID);
      db.params.add('Password='+password);
      db.loginprompt:=false;
      db.keepconnection:=true;
      db.connected:=true;
      result:=db;
end;

BTW, there's only one database per session so databasename=alias shouldn't
be a  problem (as far as duplication is concerned).