Problem in Multiple Database Connection

Hi,

I have a project that requires to integrate two databases. I have successfully created application using two database. It works when I run it from Development environment and as well as on the localhost server. As soon as I deploy on the live site it doesn’t allow secondary connection to access the database.

it says the error message:

An error occurred while connecting to the database:
Connection attempt failed: SQLSTATE[HY000] [1045] Access denied for user ‘DBUSERNAME’@‘localhost’ (using password: YES)

If I use the IP of server where the site is being hosted it returns my local network gateway IP.

An error occurred while connecting to the database:
Connection attempt failed: SQLSTATE[HY000] [1045] Access denied for user ‘DBUSERNAME’@‘MYLOCALGATEWAYIP’ (using password: YES)

I tried hosting both databse in different servers and tried accessing it. Primary connection works but the secondary connection doesn’t work.

I have supplied correct User and password for the database.

There’s problem with scriptcase.

Could you please help me?

@Giu,
@aka

Thanks