Handling multiple database users using adapter

Posts   
 
    
bjones
User
Posts: 22
Joined: 13-Feb-2004
# Posted on: 12-Apr-2007 01:07:27   

Hi guys,

What is the best way to handle many database users in the application without having to specify the userid/password with each new adapter instance?

I found lots of references to changing catalogs or schemas, but not changing/specifying users. Oh, and I would like for this to persist for the duration of the session.

Any ideas?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 12-Apr-2007 09:15:53   

Do you mean, you have multiple database accounts that you want to use when connecting to the database? If so, then you can pass the connection string manually to the Adapter, and you can store the connection string in the session to be used with each Adapter call/connection. You can create a method that instantiate the Adapter and set the connection string, so in your code you should call this method to get a new Adapter instance rather than instantiating it and set the connection string everywhere in code.