Oracle Monkey
Oracle Monkey

Reputation: 85

Spring data source configuration issue :Logon Denied

I have the below properties file in application.properties

# Database settings
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@dbbdev:1500:SIDNAME
spring.datasource.username=user$name
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect

spring.jpa.generate-ddl=off
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.show-sql=false
spring.jpa.properties.javax.persistence.validation.mode=none
spring.jpa.hibernate.format_sql=true

My main class is below : -

@SpringBootApplication
public class App 
{

    public static void main( String[] args )
    {

        SpringApplication.run(App.class, args);
        System.out.println( "Hello World!  -- "  );
    }

I am getting the below error :-

2019-06-27 16:34:39.804 WARN 14556 --- [ main] o.s.b.a.orm.jpa.DatabaseLookup : Unable to determine jdbc url from datasource

org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta-data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: ORA-01017: invalid username/password; logon denied

aused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: ORA-01017: invalid username/password; logon denied

at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81) ~[spring-jdbc-5.1.8.RELEASE.jar:5.1.8.RELEASE] at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:319) ~[spring-jdbc-5.1.8.RELEASE.jar:5.1.8.RELEASE] ... 65 common frames omitted Caused by: java.sql.SQLException: ORA-01017: invalid username/password; logon denied

I have checked my user name and password is correct .Following dependecy exis exists in parent pom

How to resolve the issue.

<properties>
        <java.version>1.8</java.version>
        <springboot.version>2.1.6.RELEASE</springboot.version>
        <ojdc.version>12.1.0.2.0</ojdc.version>


    </properties>

Upvotes: 0

Views: 1989

Answers (1)

Ananthapadmanabhan
Ananthapadmanabhan

Reputation: 6216

The stacktrace that you have attached, shows that :

 [ main] o.s.b.a.orm.jpa.DatabaseLookup : Unable to determine jdbc url from datasource

org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta-data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: ORA-01017: invalid username/password; logon denied

and the first part says that spring fails to determine the jdbc url from datasource. So, your jdbc url that you have provided in your application.properties is either wrong or it is not getting connected from your server.

Try providing the datasource url like :

# Database settings
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@dbbdev:1500/SIDNAME

if SIDNAME is your service name.

Upvotes: 0

Related Questions