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の基本動作について -自己覚書-

Posted at

Db2をインストールしたのはいいけれど、手も足も出ない。
そんな日に分かったことをつらつらと。

DB2コマンドウインドウ(管理者)起動
コマンド「db2」でdb2にアクセスするモードになる

ID:db2admin
PW:xxxpassxxx

・今存在しているデータベースの一覧を見る
list db directory

・データベース(SAMPLEDB)の作成
CREATE DATABASE SAMPLEDB ON C: USING CODESET UTF-8 TERRITORY JP COLLATE USING IDENTITY

・データベースに権限を与える
connect to sampledb
GRANT CONNECT ON DATABASE TO USER db2admin

ここまでで、データベースを作ることができ、db2adminでテーブル作成や、CRUDが出来るようになる。

・データベース(SAMPLEDB)にアクセスする
CONNECT TO SAMPLEDB user db2admin using xxxpassxxx

・データベース(SAMPLEDB)の削除
DROP DATABASE SAMPLEDB

アクセス、削除は基本。
アクセス出来れば、CreateTableなどSQL操作が出来る。
NODEとかSCHEMAとかは最初は気にしない。
まずはCUIでテーブル操作が出来ること。
次にプログラムからデータを参照することが出来ること。

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?