Connecting to Db2 or Db2 Warehouse
Connect applications and clients to Db2 or Db2 Warehouse deployments using Operator V2 from outside the cluster.
Note: This topic is for Db2 Operator V2 deployments. If you are currently using a legacy deployment,
refer to the documentation in Legacy deployment documentation. If you are unsure which deployment type you are using, use
the version
checker.
This section explains how to connect to a deployed Db2 or Db2 Warehouse instance from outside the cluster.
Supported connection patterns
The supported connection pattern depends on where your deployment runs:
- On OpenShift Container Platform, connect through an OpenShift route.
- On an on-premises Kubernetes cluster, connect through an HAProxy or other TCP ingress endpoint in front of the Db2 service.
- On a cloud provider Kubernetes service, connect through a
LoadBalancerservice.
Default ports
Db2 exposes these default ports for connectivity:
- Non-SSL port:
50000 - SSL port:
50001
Use port 50001 for encrypted connections unless you explicitly intend to use a non-SSL connection on port 50000.
Before you begin
Ensure you have the following information:
- The hostname that you must use to reach the database.
- The external port that maps to the Db2 service for the type of connection that you plan to use, whether SSL or non-SSL.
- The database name.
- The database user name and password.
- The Db2 CA certificate if your deployment uses a user-provided or cluster-issued certificate.
Which endpoint should you use?
| Platform | Recommended endpoint | Notes |
|---|---|---|
| OpenShift Container Platform | OpenShift passthrough route | Simplest option when a route is available |
| On-premises Kubernetes | HAProxy or equivalent TCP ingress in front of a NodePort service | Common when routes are not available |
| Cloud provider Kubernetes | LoadBalancer service |
Use the external IP or DNS name assigned by the cloud provider |