필터 지우기
필터 지우기

JDBC warning message: "..... The new driver class is `com.mysql​.cj.jdbc.D​river'....​"

조회 수: 210 (최근 30일)
Simon
Simon 2022년 8월 19일
댓글: Simon 2023년 11월 17일
I have configured a JDBC data source successfully. There is no problem of reading in a database from the data source.
However, when I was doing
testConnection(opts,username,password)
I received a warning message
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
According to what I google for a possible explanation, it seems that Oracle has changed the name of the driver class. There is a good explanation offered at Stackoverflow. The warning message is just a warning, and I can still successfully connect with the MySQL server. I was just wondering whether Matlab should update the driver class name accordingly in its codes.

채택된 답변

Dinesh
Dinesh 2023년 11월 17일
Hi Simon.
It is possible to remove the warning message that you are facing by specifying the name of driver class by yourself. The following code will give you an idea:
% Create the database connection object using the updated driver class
conn = database('dbname', 'username', 'password', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql://localhost:3306/dbname');
Please refer the following link:
The developers are aware of these deprecations and the code will be updated eventually.
  댓글 수: 1
Simon
Simon 2023년 11월 17일
Thanks for your answer. Because native connector works after Matlab updates, I have switched to it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by