0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Db2にODBC接続する

Posted at

Db2にDatabaseが作れたら、次はクライアントPCからの接続だ。

まずはサーバーのPORTを開ける作業が必要。
WindowsならばFireWallの設定を変更してTCPの50000を開ける。

次にクライアントPCにODBCドライバをインストールする必要がある。
http://www-01.ibm.com/support/docview.wss?rs=0&uid=swg21385217&loc=ja

IBM Data Server Driver Package (DS Driver) を選択する。
32bit or 64bitの選択は、作成するアプリケーションが32bitならば32bit。
そうでなければ64bit。とする。

DLしてインストール。
この辺は問題なさそう。

DSNで接続テストをして、繋がることを確認しておくといい。

プログラムでは以下のように書く。
driver={IBM DB2 ODBC DRIVER};Database=SAMPLEDB;hostname=192.168.0.61;port=50000;protocol=TCPIP;uid=db2admin;pwd=xxxpassxxx

これでつながる。
黒猫SQLもこの文字列でつながる。
SQL Serverと違って少し項目が多いが気にしない。
これにセキュリティとか考えて増やせばいい。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?