Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-9382

(7.4.z) UCP driver can't retrieve credentials from standard data source attributes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • None
    • Testing/Validation
    • Hide
      import java.sql.Connection;
      
      import oracle.ucp.jdbc.PoolDataSourceImpl;
      
      public class JBEAP9382 {
      
          public static void main(String[] args) throws Exception {
              PoolDataSourceImpl ds = new PoolDataSourceImpl();
              ds.setInactiveConnectionTimeout(0);
              ds.setPropertyCycle(900);
              ds.setValidateConnectionOnBorrow(true);
              ds.setMaxPoolSize(20);
              ds.setMinPoolSize(0);
              ds.setFastConnectionFailoverEnabled(true);
              ds.setAbandonedConnectionTimeout(0);
              ds.setURL("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=172.17.0.2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=mypdb)))");
              ds.setConnectionPoolName("ucp-pool-1561535129141389829");
              ds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
              ds.setConnectionWaitTimeout(0);
              ds.setTimeToLiveConnectionTimeout(0);
      
      //        ds.setUser("user1");
      //        ds.setPassword("user1");
      
              Connection conn = null;
              try {
                  conn = ds.getConnection("user1", "user1");
              } finally {
                  if (conn != null)
                      conn.close();
              }
          }
      }
      
      javac -cp ucp.jar:ojdbc8.jar JBEAP9382.java
      java -cp .:ucp.jar:ojdbc8.jar:ons.jar JBEAP9382
      
      Show
      import java.sql.Connection; import oracle.ucp.jdbc.PoolDataSourceImpl; public class JBEAP9382 { public static void main( String [] args) throws Exception { PoolDataSourceImpl ds = new PoolDataSourceImpl(); ds.setInactiveConnectionTimeout(0); ds.setPropertyCycle(900); ds.setValidateConnectionOnBorrow( true ); ds.setMaxPoolSize(20); ds.setMinPoolSize(0); ds.setFastConnectionFailoverEnabled( true ); ds.setAbandonedConnectionTimeout(0); ds.setURL( "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=172.17.0.2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=mypdb)))" ); ds.setConnectionPoolName( "ucp-pool-1561535129141389829" ); ds.setConnectionFactoryClassName( "oracle.jdbc.pool.OracleDataSource" ); ds.setConnectionWaitTimeout(0); ds.setTimeToLiveConnectionTimeout(0); // ds.setUser( "user1" ); // ds.setPassword( "user1" ); Connection conn = null ; try { conn = ds.getConnection( "user1" , "user1" ); } finally { if (conn != null ) conn.close(); } } } javac -cp ucp.jar:ojdbc8.jar JBEAP9382.java java -cp .:ucp.jar:ojdbc8.jar:ons.jar JBEAP9382

      Updated on May 14th: This now needs to work on Oracle 18 since we tentatively plan to certifiy Oracle 18 and deprecate / remove Oracle 12c in EAP 7.3 timeframe.

      With UCP driver 12.1, you are able to specify user credentials using the usual username and password attributes of the data source. This doesn't work with 12.2.0.1, you have to specify it as User and Password connection properties.

      However, if you want to use allow-multiple-users on the DS then doesn't work well with the test-connection-in-pool operation (which, if invoked without arguments, retrieves credentials from DS attributes). Attempting it fails with a "logon denied" message.

      This workaround has one more issue: the password, when set as connection property, is visible in plain text in the admin console.

      12.2.0.1 UCP + JDBC drivers can be obtained here: http://www.oracle.com/technetwork/database/application-development/jdbc/jdbc-ucp-122-3110062.html

      Update June 26th:
      retested with Oracle DB 19.3 and ucp/ojdbc/ons 19.3: still issue

      Stacktrace:

      Exception in thread "main" java.sql.SQLException: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.sql.SQLException: ORA-01017: invalid username/password; logon denied
      
              at oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java:456)
              at oracle.ucp.util.UCPErrorHandler.throwSQLException(UCPErrorHandler.java:133)
              at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:928)
              at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:1961)
              at oracle.ucp.jdbc.PoolDataSourceImpl.access$400(PoolDataSourceImpl.java:201)
              at oracle.ucp.jdbc.PoolDataSourceImpl$31.build(PoolDataSourceImpl.java:4279)
              at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:1917)
              at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:1880)
              at JBEAP9382.main(JBEAP9382.java:27)
      Caused by: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.sql.SQLException: ORA-01017: invalid username/password; logon denied
      
              at oracle.ucp.util.UCPErrorHandler.newUniversalConnectionPoolException(UCPErrorHandler.java:336)
              at oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolException(UCPErrorHandler.java:59)
              at oracle.ucp.jdbc.oracle.OracleDataSourceConnectionFactoryAdapter.createConnection(OracleDataSourceConnectionFactoryAdapter.java:134)
              at oracle.ucp.common.Database.createPooledConnection(Database.java:256)
              at oracle.ucp.common.Topology.start(Topology.java:247)
              at oracle.ucp.common.Core.start(Core.java:2313)
              at oracle.ucp.common.UniversalConnectionPoolBase.start(UniversalConnectionPoolBase.java:685)
              at oracle.ucp.jdbc.oracle.OracleJDBCConnectionPool.start(OracleJDBCConnectionPool.java:129)
              at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:924)
              ... 6 more
      Caused by: java.sql.SQLException: ORA-01017: invalid username/password; logon denied
      
              at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:509)
              at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:456)
              at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:451)
              at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:1040)
              at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:552)
              at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550)
              at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268)
              at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:501)
              at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:1292)
              at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:1025)
              at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:743)
              at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:793)
              at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:57)
              at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:747)
              at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:406)
              at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:291)
              at oracle.jdbc.pool.OracleDataSource$1.build(OracleDataSource.java:1683)
              at oracle.jdbc.pool.OracleDataSource$1.build(OracleDataSource.java:1669)
              at oracle.ucp.jdbc.oracle.OracleDataSourceConnectionFactoryAdapter.createConnection(OracleDataSourceConnectionFactoryAdapter.java:103)
              ... 12 more
      

              rhn-cservice-bbaranow Bartosz Baranowski
              jmartisk@redhat.com Jan Martiska
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: