1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Db2へのJDBC接続の簡単なテスト方法

Last updated at Posted at 2024-12-21

概要

Db2に対してJDBC接続を行う際、ネットワークが疎通できているか、接続パラメータが正しいかをテストしたいことがあります。Db2のJDBCドライバ(db2jcc.jar/db2jcc4.jar)には接続テスト用のプログラムが同梱されており、JDBCドライバとJavaの実行環境があれば、JDBC接続を1コマンドで簡単にテストすることができます。

手順

以下のコマンドでDb2へのJDBC接続をテストできます。

# コマンド
java -cp <JDBCドライバ(db2jcc.jar/db2jcc4.jar)のパス> com.ibm.db2.jcc.DB2Jcc -url <JDBC URL> -user <DBユーザ> -password <DBパスワード>

# コマンド実行例
java -cp /jdbc/driver/db2jcc4.jar com.ibm.db2.jcc.DB2Jcc -url jdbc:db2://mydb.example.com:50000/MYDB -user db2user -password db2password
1
0
3

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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?