title: Could not get JDBC Connection; nested exception is java.sql.SQLException: ORA-28040: No matching authentication protocol in Spring Batch
body: <p>I am using Spring Batch and connecting to Oracle 12c instance.</p>
  
  <blockquote>
    <p>org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: ORA-28040: No matching authentication protocol</p>
  </blockquote>
  
  <p>And I am getting the below error : </p>
  
  <pre><code>org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: ORA-28040: No matching authentication protocol
  
      at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:619)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:684)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:716)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:726)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:781)
      at org.springframework.batch.core.repository.dao.JdbcJobInstanceDao.getJobInstance(JdbcJobInstanceDao.java:145)
      at org.springframework.batch.core.repository.support.SimpleJobRepository.getLastJobExecution(SimpleJobRepository.java:284)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:280)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
      at com.sun.proxy.$Proxy1.getLastJobExecution(Unknown Source)
      at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:98)
      at CustomerFileGenerationMain.main(CustomerFileGenerationMain.java:28)
  Caused by: java.sql.SQLException: ORA-28040: No matching authentication protocol
  </code></pre>
  
  <p>Spring Batch xml file</p>
  
  <pre><code>&lt;bean id="DataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /&gt;
      &lt;property name="username" value="MY_OWNER"/&gt;
      &lt;property name="url" value="jdbc:oracle:thin:@//localhost:1527/myCloud" /&gt;
      &lt;property name="password" value="" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" /&gt;
  
  &lt;bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean" &gt;
      &lt;property name="dataSource" ref="DataSource" /&gt;
      &lt;property name="transactionManager" ref="transactionManager" /&gt;
      &lt;property name="databaseType" value="ORACLE" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>and pom.xml file - 
  Only this dependency I used</p>
  
  <pre><code>&lt;dependency&gt;
              &lt;groupId&gt;com.oracle&lt;/groupId&gt;
              &lt;artifactId&gt;ojdbc6&lt;/artifactId&gt;
              &lt;version&gt;11.2.0.3&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>I tried below as well..
  </p>
  
  <pre><code>&lt;dependency&gt;
              &lt;groupId&gt;com.oracle&lt;/groupId&gt;
              &lt;artifactId&gt;ojdbc7&lt;/artifactId&gt;
              &lt;version&gt;12.1.0.1&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>Please guide how to convert below code to XML bean ?</strong></p>
  
  <pre><code>@Bean(name = "DataSource")
      public DataSource batchDataSource() throws IOException {    
          OracleDataSource ds = null;
          MCUserInfoFactory userInfoFactory = new MCUserInfoFactory();
          try {
              MCUserInfo userInfo = userInfoFactory.getMCUserInfo(XXXXLabel);
              if (userInfo != null) {
                  ds = getDataSource(userInfo, edsurl);
              }
          } catch (Exception e) {
  
          }
          return ds;
      }
  </code></pre>
  
  <p>I am using the following version - </p>
  
  <pre><code>/:/oracle/home $ sqlplus / as sysdba
  -bash: sqlplus: command not found
  /:/oracle/home $ . ~/.profile
  /:/oracle/home $ sqlplus / as sysdba
  
  SQL*Plus: Release 12.1.0.2.0 Production on Thu Jun 28 01:56:56 2018
  
  Copyright (c) 1982, 2014, Oracle.  All rights reserved.
  
  
  Connected to:
  Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
  and Real Application Testing options
  </code></pre>