java.sql.SQLException: ORA-01017: invalid username/password; logon denied

1.7k Views Asked by At

I have an issue regarding connecting a spring project to an oracle database 12 c.

My config.properties file is like the following

jdbc.driverClassName=oracle.jdbc.OracleDriver
jdbc.url=jdbc:oracle:thin:@ip:1521:sid
jdbc.username=XXXX
jdbc.password=XXXX

My aplication-context.xml file is as follows:

   <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}" />
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
   </bean>

This was working before, but then we changed the username of the database for something else and then it stopped working.

Previously we had a problem with the encoding and since our password has an underscore in it, we had to used a escape character to make it work like this (\). But then again we had to change the username and it stopped working!

Any help will be much appreciated. Thank you for your time.

1

There are 1 best solutions below

1
On

1) Try jdbc URL on this format:

jdbc:oracle:thin:hr/hr@localhost:1521:oracle

2) Try Driver class:
oracle.jdbc.driver.OracleDriver

    Because class oracle.jdbc.driver.OracleDriver extends oracle.jdbc.OracleDriver.

Test one by one Or both.. I hope it works.