6
5

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 5 years have passed since last update.

Loading class `com.mysql.jdbc.Driver'. This is deprecated.エラーの意味と解決

Posted at

#問題
Loading class `com.mysql.jdbc.Driver'. This is deprecated.

##意味
com.mysql.jdbc.Driverをロードします。非推奨です。

##解決
com.mysql.cj.jdbc.Driverを使用する。
(問題の文に続いてThe new driver class is `com.mysql.cj.jdbc.Driver'.(=新しいドライバーはcom.mysql.cj.jdbc.Driverです)とあるので)

##方法(やることは二つ)

###Step1:
下記のようなコードがあるはずなので、com.mysql.jdbc.Driverの部分をcom.mysql.cj.jdbc.Driverに変更する。

example.java
static {
		//JDBCドライバのロード
		String drv="com.mysql.jdbc.Driver";
		try {
			Class.forName(drv);
		}catch(ClassNotFoundException e) {
			System.out.println("ドライバがありません"+e.getMessage());
		}

###Step2:
DBViewer開く。使っているデータベースを右クリック➡『編集』➡『次へ』。
【接続情報】のJDVC Driver(J):の欄の、com.mysql.jdbc.Driverの部分をcom.mysql.cj.jdbc.Driverに変更する。完了。

6
5
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
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?