# DB Connections with hardcoded database.yml username? How do

**URL:** <https://www.ruby-forum.com/t/db-connections-with-hardcoded-database-yml-username-how-do/104401>\
**Category:** Rails\
**Created:** [May 17, 2007, 4:10pm UTC](https://www.ruby-forum.com/t/db-connections-with-hardcoded-database-yml-username-how-do/104401 "2007-05-17T16:10:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbaman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@dbaman](https://www.ruby-forum.com/u/dbaman)\
**Post date:** [May 17, 2007, 4:10pm UTC](https://www.ruby-forum.com/t/db-connections-with-hardcoded-database-yml-username-how-do/104401/1 "2007-05-17T16:10:35Z")

</div>

I’m a bit (OK…a lot) confused about the way Rails establishes a DB  
connection with the login/passwd that is hardcoded in database.yml,  
even in production mode.

I’m using Rails to develop internal, inward-facing apps for my  
company, rather than an external, outward-facing public  
web site.

Once an end-user of my app authenticates w/ his login and passwd, I  
want him to connect to the database with _his_ login, rather than some  
generic database.yml login that everyone uses. Different users have  
different DB privileges, and diagnosing back-end DB issues is easier  
when I am seeing unique logins rather than a generic one. (I’m a  
DBA).

I can certainly understand that, for a public web site, with  
potentially hundreds or thousands of users, you don’t want each user  
to have an official OS-level login that they can connect to the DB  
with. But in my case, each of my several dozen users already has an  
OS-level login. I use DB2, and its logins are based on those in the  
OS.

Am I missing something here? Can Rails be influenced to conect to the  
DB in this way?

Any help appreciated.

aj
