Thursday, December 24, 2020

Remote connection - Cataloging a TCP/IP node from a client using the CLP

 [db2inst1@unica12-1-rhel79 ~]$ . ~/sqllib/db2profile

[db2inst1@unica12-1-rhel79 ~]$ db2

(c) Copyright IBM Corporation 1993,2007

Command Line Processor for DB2 Client 11.1.0


You can issue database manager commands and SQL statements from the command

prompt. For example:

    db2 => connect to sample

    db2 => bind sample.bnd


For general help, type: ?.

For command help, type: ? command, where command can be

the first few keywords of a database manager command. For example:

 ? CATALOG DATABASE for help on the CATALOG DATABASE command

 ? CATALOG          for help on all of the CATALOG commands.


To exit db2 interactive mode, type QUIT at the command prompt. Outside

interactive mode, all commands must be prefixed with 'db2'.

To list the current command option settings, type LIST COMMAND OPTIONS.


For more detailed help, refer to the Online Reference Manual.


db2 => catalog tcpip4 node database-rhel79 remote 192.168.0.52 server 50000

SQL0104N  An unexpected token "database-rhel79" was found following "NODE".

Expected tokens may include:  "<node-name>".  SQLSTATE=42601

db2 => catalog tcpip node db2node remote database-rhel79 server 50000

DB20000I  The CATALOG TCPIP NODE command completed successfully.

DB21056W  Directory changes may not be effective until the directory cache is

refreshed.

db2 => catalog database unicadb at node db2node

DB20000I  The CATALOG DATABASE command completed successfully.

DB21056W  Directory changes may not be effective until the directory cache is

refreshed.

db2 => connect to unicadb user uc

Enter current password for uc:


   Database Connection Information


 Database server        = DB2/LINUXX8664 11.1.0

 SQL authorization ID   = UC

 Local database alias   = UNICADB


db2 =>


Monday, December 21, 2020

JBoss Deployment

 Reference:

http://hegdesai.blogspot.com/2013/10/registering-db2-driver-with-jboss-711.html



For DB2: the command via cli is:


./jboss-cli.sh


You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.


[disconnected /] connect

module add --name=com.ibm.db2 --resources=/apps/ibm/db2/V11.1/java/db2jcc4.jar,/apps/ibm/db2/V11.1/java/db2jcc_license_cu.jar --dependencies=javax.api,javax.transaction.api --resource-delimiter=,

/subsystem=datasources/jdbc-driver=db2:add(driver-name=db2,driver-module-name=com.ibm.db2,driver-xa-datasource-class-name=com.ibm.db2.jcc.DB2XADataSource, driver-class-name=com.ibm.db2.jcc.DB2Driver)

{"outcome" => "success"}

[standalone@localhost:9990 /]


to remove:

module remove --name=com.ibm.db2



For mariadb:

Setup DB Driver


./jboss-cli.sh


You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.

[disconnected /] module add --name=org.mariadb --resources=/apps/installers/mariadb-java-client-2.5.3.jar --dependencies=javax.api,javax.transaction.api

[disconnected /] connect

[standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=mariadb:add(driver-name=mariadb,driver-module-name=org.mariadb,driver-xa-datasource-class-name=org.mariadb.jdbc.MySQLDataSource, driver-class-name=org.mariadb.jdbc.Driver)

{"outcome" => "success"}

[standalone@localhost:9990 /]



To setup multiple instance, I will copy the whole standalone folder and modify the .xml and .conf files inside
Directory:

standalone_UMP

standalone_UC



Add Datasource in Standalone.xml

(Difference between original and new copy)


165a166,180

>                 <datasource jta="true" jndi-name="java:/CampaignPartition1DS" pool-name="CampaignPartition1DS" enabled="true" use-ccm="false">

>                     <connection-url>jdbc:mariadb://rhel73.localdomain.com:3306/UCDB</connection-url>

>                     <driver-class>org.mariadb.jdbc.Driver</driver-class>

>                     <driver>mariadb</driver>

>                     <security>

>                         <user-name>UC</user-name>

>                         <password>P@ssw0rd</password>

>                     </security>

>                     <validation>

>                         <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>

>                         <validate-on-match>true</validate-on-match>

>                         <background-validation>false</background-validation>

>                         <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>

>                     </validation>

>                 </datasource>

522,528c537,543

<         <socket-binding name="management-http" interface="any" port="${jboss.management.http.port:9990}"/>

<         <socket-binding name="management-https" interface="any" port="${jboss.management.https.port:9993}"/>

<         <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>

<         <socket-binding name="http" port="${jboss.http.port:8080}"/>

<         <socket-binding name="https" port="${jboss.https.port:8443}"/>

<         <socket-binding name="txn-recovery-environment" port="4712"/>

<         <socket-binding name="txn-status-manager" port="4713"/>

---

>         <socket-binding name="management-http" interface="any" port="${jboss.management.http.port:29990}"/>

>         <socket-binding name="management-https" interface="any" port="${jboss.management.https.port:29993}"/>

>         <socket-binding name="ajp" port="${jboss.ajp.port:28009}"/>

>         <socket-binding name="http" port="${jboss.http.port:28080}"/>

>         <socket-binding name="https" port="${jboss.https.port:28443}"/>

>         <socket-binding name="txn-recovery-environment" port="24712"/>

>         <socket-binding name="txn-status-manager" port="24713"/>

530c545

<             <remote-destination host="localhost" port="25"/>

---

>             <remote-destination host="localhost" port="26"/>



Adding JVM parameters in standalone.conf file



JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Dclient.encoding.override=UTF-8"



War file to deployed via UI

 

 

Startup command:

standalone.sh -Djboss.server.base.dir=/apps/EAP-7.1.0/standalone_UMP

standalone.sh -Djboss.server.base.dir=/apps/EAP-7.1.0/standalone_UC

Thursday, December 17, 2020

Packages needed for DB211.1 on Redhat 7.9

perl-Sys-Syslog (not documented)

pam.i686

compat-libstdc++-33


Check /tmp/db2setup.log after installation for errors for missing packages.



Also if you get : 

Update DBM cfg SYSADM_GROUP errcode = 8

Ensure that your /etc/hosts is configured with your hostname and then you can ping the hostname. See this:https://www.ibm.com/support/pages/sql6048n-when-creating-new-instance



If need to reinstall DB2

 1. Delete all db2 users in /etc/passwd

2. Delete all db2 groups in /etc/group

3. Delete directory /var/db2

4. Delete directory DB2 install eg /opt/ibm/

Wednesday, December 16, 2020

To install DB2...

 Run the command ./db2setup 


:-)


Something simple but there are also other binaries in the install folder which can be misleading (db2_install).

Remember to run db2prereqcheck first though till you get :

DBT3533I  The db2prereqcheck utility has confirmed that all installation prerequisites were met.

 Validating "/lib/libpam.so*" ...

   Requirement matched.

Requirement not matched for DB2 database "Server" with pureScale feature . Version: "9.8.0.2".

Summary of prerequisites that are not met on the current system:

   Required minimum C++ library: "libstdc++.so.5"

   Actual version is undetermined



Need to do the following:

You won't find it on the physical iso media. It is in the online repository id named "rhel-7-server-optional-rpms".

You can see a list of all repositories with

$ yum repolist all

and you can enable the above repo with

$ yum-config-manager --enable rhel-7-server-optional-rpms

yum should be able to find and install the compat rpm now...

$ yum install compat-libstdc++-33



Before u do the above need to do this:

http://linux-vignettes.blogspot.com/2020/12/enable-subscription-on-redhat.html

Disable SELinux

 If you get the following error when running ./db2prereqcheck

DBT3563E  The db2prereqcheck utility determined that SELinux is enabled, which is not supported with GPFS.


Do the following:


Disabling SELinux
  1. If editing the config file, Open the /etc/selinux/config file (in some systems, the /etc/sysconfig/selinux file).
  2. Change the line SELINUX=enforcing to SELINUX=permissive.
  3. Save and close the file.
  4. Reboot your system.


For more details on what SELinux is:
https://www.computernetworkingnotes.com/rhce-study-guide/selinux-explained-with-examples-in-easy-language.html

DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".

 http://linux-vignettes.blogspot.com/2014/12/missing-libpamso0-on-my-64bit-rhel6-for.html