学習jdbcTemplate接続jdbcで発生したいくつかの問題の概要

1269 ワード

学習jdbcTemplate接続jdbcで発生したいくつかの問題の概要
質問1:Cannot load driver class:com.mysql.jdbc.Driver
まず、データベースに接続するときに、ログにCannot load driver class:com.mysql.jdbc.Driverはdriverに接続できないと言って、後で資料を調べてmysql-connector-java-5.147-binをダウンロードする必要があることを発見しました.JArでjaiパッケージをweb-ifのlibファイルの下に配置します.
問題2データベース5.5.45以降の変更
According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. mySQlは5.5.45+,5.6.26+and 5.7.6のいくつかのバージョンでローカル接続データベースにいくつかの制約と要求があり、URIの内容の後に?useUnicode=true&characterEncoding=utf-8&useSSL=false‘を追加すれば問題ありません.
問題3パスワード書き間違い
Could not get JDBC Connection Cannot create PoolableConnectionFactory(Access denied for user‘root’@‘localhost’(using password:YES))この問題は、SQLデータベースに入るパスワードを書き間違えたので、パスワードを正しく書けばいいのではないでしょうか.
#問題4
jdbcTemplate.update("insert into t_user(username,PASSWORD) values(?,?)","tom"
				,"998");

valueここに2つの疑問符を書く必要はありません.こんな形で