OCIError (ORA-01017: invalid username/password; login denied

We're trying to deploy our system on a separate server and have run into
nothing but trouble; specifically I get the error mentioned in the
subject. The username/password combo is correct (I verified it via
SQL+). Manually running script/server works fine in production or
development mode. Heck, running script/console also works fine. It's
just that when it automatically starts up as part of server startup that
I get this error; it's unfortunately exactly that situation that we need
to use it.

My database.yml looks like:

  adapter: oracle_enhanced
  database: blarg
  username: abcde
  password: abcde

  adapter: oracle_enhanced
  database: blarg
  username: abcde
  password: abcde

I've googled all over the place for answers to this but all I find are
threads where somebody has the problem and nobody has a solution. Any
help is welcome!

When I deploy to production using Oracle, I have to set two
environment variables: