Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  MAS8 db2wh connection failed from dbeaver

    Posted Wed March 27, 2024 08:16 PM
    Edited by suman kumar Wed April 10, 2024 08:05 PM

    Hi,

    Im trying to connect to mas8 manage database from dbeaver however test connection is failing.

    in dbeaver connection properties, i have created .jks file from ssl certification from operator>secrets "db2u-certificate"  and added .jks file  driver properties with ssl options.

    sslConnection - true
    sslTrustStoreLocation - Location of the jks file created in the previous steps. (mydb2wstore.jks )
    sslTrustStorePassword - Password you have enter while creating jks

    Thanks in advance.



    ------------------------------
    suman kumar
    ------------------------------



  • 2.  RE: MAS8 db2wh connection failed from dbeaver

    Posted Thu March 28, 2024 01:40 AM
    Edited by Maycon Belfort Thu March 28, 2024 01:41 AM

    Hi Suman,

    DB2 database is in the local network, and you cannot access it from outside the cluster by accessing the route URL like you're doing. You'll need to forward the port from the pod running DB2 to your localhost.

    #Login to your Cluster
    
    oc login ...
    
    # Change your project to where DB2 is running
    
    oc project <project_name>
    
    # List the pods to get the DB2 pod
    
    oc get pods
    
    # Forward the DB2 port to your localhost
    
    oc port-forward <pod> 50001:50001

    Connect from your DBeaver using jdbcdb2://localhost:50001/BLUDB



    ------------------------------
    Maycon Belfort
    Consultant
    BPD Zenith
    Melbourne
    Australia
    ------------------------------



  • 3.  RE: MAS8 db2wh connection failed from dbeaver

    Posted Fri March 29, 2024 07:15 AM

    Hi Suman,

    this is the setup how it works for me:

    ## Setting up external access to Db2

    oc get svc -n db2u | grep engn-svc
    ## c-db2u-manage-db2u-engn-svc   NodePort    172.30.9.255    <none>        50000:30168/TCP,50001:31520/TCP

    oc create route passthrough db2-manage-route -n db2u --port ssl-server --service c-db2u-manage-db2u-engn-svc --insecure-policy=None

    oc get route db2-manage-route -n db2u -o jsonpath="{.spec.host}{'\n'}"
    ## db2-manage-route-db2u.apps.[ocp-domain]

    oc get secret -n db2u c-db2u-manage-instancepassword -o jsonpath="{.data.password}" | base64 -d ; echo
    ## [password]

    oc get secret -n db2u db2u-ca -o jsonpath="{.data.ca\.crt}" | base64 -d > /tmp/db2-ca.pem


    ## use file  /tmp/db2-ca.pem to generate *.jks

    keytool -importcert -keystore certdb2.jks -storepass password123 -file db2-ca.pem -alias cert

    --------------------------------------------------
    Dbeaver setup - DB2 LUW

     Main tab
     Host: db2-manage-route-db2u.apps.[ocp-domain]
     Port: 443
     Database: BLUDB
     Username: db2inst1
     Password: [password]

    Driver Properties tab
     sslConnection=True
     TrustServerCertificate=True
     sslTrustStoreType=jks
     sslTrustStoreLocation=[path_to_jks_file\certdb2.jks]
     sslTrustStorePassword=password123



    ------------------------------
    Jan Ondrusek
    ------------------------------



  • 4.  RE: MAS8 db2wh connection failed from dbeaver

    Posted Fri March 29, 2024 08:48 AM

    Hi Suman,

    It will not allow to connect database directly from outside cluster. We have to perform some steps at OCP level to access the database.

    Option 1:

    Port forward - Maycon has shared the same.

    Option 2:

    • Login to OCP
    • Navigate to Networking -> Services -> Open DB2 service ->Click on YAML Tab
    • Change the below details in YAML file
    • Search for "type" and it is below to "clusterIPs" in YAML 
    • Change type to "NodePort". It will create node port IPs for db-server
    • Request OCP team to open nodeport port.
    • Now use below format to connect database  jdbcdb2://<any master node ip>:<nodeport>/BLUDB



    ------------------------------
    Ramakrishnudu Kayala
    ------------------------------



  • 5.  RE: MAS8 db2wh connection failed from dbeaver

    Posted Fri April 12, 2024 02:21 PM

    Thank you all.

    First option worked for me i.e. forwarding the port.

    oc port-forward pod/c-db2wh-db01-db2u-0 50000:50000 -n db2u


    Forwarding from 127.0.0.1:50000 -> 50000
    Forwarding from [::1]:50000 -> 50000
    Handling connection for 50000

    Thanks,

    Suman



    ------------------------------
    suman kumar
    ------------------------------