I am creating an application where a user logs into an Oracle Database and runs prepared queries. I would like to use ActiveRecord to help run the queries, but I am running into some issues.
When the user attempts to login, I test the connection by running
def test (username, password)
ActiveRecord::Base.establish_connection({
:adapter => 'oracle_enhanced',
:database => '//database:1521/test',
:username => username,
:password => password
})
end
However, if a user inputs incorrect login information, I get the following error:
OCIError
ORA-01017: invalid username/password; logon denied
on the rails page. When I try to reload the login page, it keeps showing that error and does not show the actual login page. The only way to remove this error is to restart the entire rails application.
Is this because I attempted to establish connection to a different database but it fails and it doesn't know what to do? Is there any way I can prevent this from happening?