用戶端串連Linux作業系統上的DB2資料庫

來源:互聯網
上載者:User

 

這裡主要針對用戶端串連Linux作業系統上的DB2資料庫

1、DB2的安裝,可以參考IBM協助文檔:

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/basic/help.jsp?topic=/com.ibm.db2.luw.qb.server.doc/doc/r0008865.html

(使用者:root,db2inst1)

2、windows用戶端串連

·DbVisualizer串連

·控制中心串連

 

2.1DbVisualizer串連

 

1、準備驅動程式,這個工具是採取JDBC方式進行資料庫連接的,所以要準備驅動,DB2串連資料庫的驅動有4種,具體可以參考相關網站說明;我們這裡需要兩個驅動:db2jcc.jar和db2jcc_license_cu.jar

2、建立資料庫的串連資訊

 

3、有的時候會報錯:這裡針對“root capability required”,主要是資料庫使用者db2inst1需要擁有root的許可權。這裡我們使用“db2rfe”

具體操作:

 

  找到樣本設定檔。 提供了兩個樣本設定檔: $HOME/sqllib/instance/db2rfe.cfg 是使用預設值為非 root 使用者 DB2® 執行個體預先配置的 $HOME/sqllib/cfg/db2rfe.cfg.sample 未經過配置
其中 $HOME 是非 root 使用者的主目錄。 將其中一個樣本設定檔複製到其他位置,以使初始檔案保持不變。 根據需要更新被複製的設定檔。 此設定檔已輸入到 db2rfe 命令中(本次修改兩個地方,標紅部分)。

====================================================================================

 

**

** Sample configuration file for db2rfe of IBM DB2

** -----------------------------------------------

**

** To select features and settings to configure, uncomment the corresponding

** keywords and specify values for those keywords.

**

** Comments are made by placing either an asterisk (*) or a number sign (#) at

** the start of a line

**

** =========================================================================

INSTANCENAME=db2inst1

** This is required keyword.

 

 

** ----------------------------------------------------------------------------

** Enable DB2 Advanced Copy Services (ACS).

** ----------------------------------------------------------------------------

** Valid value is NO and YES. Change to YES if you need to enable DB2 ACS.

 

ENABLE_DB2_ACS=NO

 

** ----------------------------------------------------------------------------

** Enable DB2 High Availability (HA) feature

** ----------------------------------------------------------------------------

** Valid value is NO and YES. Change to YES if you need to enable this feature.

 

ENABLE_HA=NO

 

** ------------------------------------------------------------------------------

** ENABLE DB2 Authentication on the server using local operating system security.

** ------------------------------------------------------------------------------

** Valid value is NO and YES. Change to YES if you need to enable this feature.

 

ENABLE_OS_AUTHENTICATION=YES

 

** --------------------------------------------

** Reserve DB2 remote connection service entry

** --------------------------------------------

** Valid value is NO and YES. Change to YES if you need to do the reservation.

** If SVCENAME and/or SVCEPORT are defined and valid, the DB2 database manager

** configuration will be updated accordingly.

 

RESERVE_REMOTE_CONNECTION=YES

 

*SVCENAME=db2c_db2inst1

** char(14)

 

*SVCEPORT=48000

** Valid value: 1024 - 65535

 

** --------------------------------------

** Reserve DB2 text search  service entry

** --------------------------------------

** Valid value is NO and YES. Change to YES if you need to do the reservation.

** If SVCENAME_TEXT_SEARCH and/or SVCEPORT_TEXT_SEARCH are defined and valid,

** the DB2 Text Search configuration will be updated accordingly.

 

RESERVE_TEXT_SEARCH_CONNECTION=NO

 

*SVCENAME_TEXT_SEARCH=db2j_db2inst1

** char(14)

 

*SVCEPORT_TEXT_SEARCH=53000

** Valid value: 1024 - 65535

 

==================================================================================== 以 root 使用者權限的使用者身份登入。 瀏覽至 $HOME/sqllib/instance 目錄,其中 $HOME 表示非 root 使用者的主目錄。 使用下列文法來運行 db2rfe 命令:
db2rfe -f config_file           (使用  ./db2rfe -f config_file)
其中 config_file 是在上面步驟中建立的設定檔。

 

2.2控制中心的串連

需要設定Catalog,具體步驟:

·db2 catalog tcpip node hljnode remote 192.168.100.54 server 50000

·db2 catalog db sample at node hljnode

·重新整理資料庫

說明:linux的Ip 192.168.100.54

hljnode自訂節點名

sample是一個範例資料庫

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.