Retrieving the Db2 or Db2 Warehouse port number
You can use the Db2 or Db2 Warehouse
NodePort
service to connect JDBC or ODBC applications to Db2 or Db2 Warehouse on
Red Hat OpenShift.
You can find the NodePort
by using the web console or commands:
- Web console
-
After you deploy the database, the console displays the
NodePort
that applications should use for client connections in the JDBC Connection URL field of the Access information section of the database details page for both SSL and non-SSL connections. - Commands
- The command differs for SSL and non-SSL ports:
- SSL port
-
oc get svc -n project db2_service_name -o jsonpath='{.spec.ports[?(@.name=="ssl-server")].nodePort}'
- Non-SSL port
-
oc get svc -n project db2_service_name -o jsonpath='{.spec.ports[?(@.name=="legacy-server")].nodePort}'
Where:
- project is the OpenShift® project where Db2 or Db2 Warehouse is deployed.
- service_name is the unique identifier that is assigned to each Db2® deployment. The service name always starts with
c-db2oltp
, for examplec-db2oltp-1605022957148004-db2u-engn-svc
.
For more information, see Configuring ingress cluster traffic using a NodePort.