In the Artifactory v6.x, we can easily use the LDAP based DB URL to connect to the database, however, this fails with Artifactory v7.x,as Metadata service cannot establish the connection with the database. To overcome the issue, use the below LDAP request to get the correct "cn" corresponding to the connection details,
ldapsearch -x -b cn=OracleContext,dc=int,dc=ora,dc=sbcore,dc=net new-netservicename.ldif: dn: cn=testdb1,cn=OracleContext,dc=example,dc=org objectclass: top objectclass: orclNetService cn: testdb1 orclNetDescString: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE)))Make sure we pass on the correct values (dn values should correspond to the connection details) here in the new-netservicename.ldif file,
Check anonymous.ldif so that the olcAccess (here {2}) matches the one identified previously. Replace the acl to give anonymous access ldapmodify -x -w "config" -D "cn=admin,cn=config" -f anonymous.ldif ### Test that anonymous can find the connection details ldapsearch -x -b cn=testdb1,cn=OracleContext,dc=example,dc=org ## Configure the oracle client to use ldap 2 files need to be put in your oracle client installation path. ### ldap.ora ``` # Place this file in the network/admin subdirectory or your # $ORACLE_HOME location. DIRECTORY_SERVERS = (localhost:389:636) DEFAULT_ADMIN_CONTEXT = "dc=example,dc=org" <---- must match dc where is stored the connection object DIRECTORY_SERVER_TYPE = OID ``` ### sqlnet.ora ``` # Place this file in the network/admin subdirectory or your # $ORACLE_HOME location. SQLNET.AUTHENTICATION_SERVICES=(NTS) NAMES.DIRECTORY_PATH = (LDAP) ``` # Configure MDS to connect In system yaml, or with env vars: ``` JF_METADATA_DATABASE_URL: go:<username>/<password>@testdb1 <---- must match cn in new-netservicename.ldif TNS_ADMIN:/<path_to_instant_client>/network/admin ``` # Launch MDS It should connect.And in the Metadata DB URL make sure to pass on the cn of the corresponding connection instead of the servicename.
metadata: database: url: "go:<username>/<password>@testdb1"So that system.yaml will look like below,
shared: node: haEnabled: false id: art1 ip: 12.34.45.67 env: LD_LIBRARY_PATH: /opt/instantclient_19_8 TNS_ADMIM: /opt/instantclient_19_8/network/admin database: type: oracle driver: oracle.jdbc.OracleDriver url: jdbc:oracle:thin@ldap://<connection_string>:<port>/testdb1,cn=OracleContext,dc=example,dc=org username: username password: password artifactory: port: 8081 tomcat: connector: maxThreads: 200 sendReasonPhrase: true relaxedPathChars: '[]' relaxedQueryChars: '[]' user: artifactory access: http: port: 8040 tomcat: connector: maxThreads: 50 sendReasonPhrase: true metadata: database: url: "go:<username>/<password>@testdb1" env: JF_METADATA_DATABASE_URL: go:<username>/<password>@testdb1