LoginSignup
0

More than 5 years have passed since last update.

MariaDB Connector/J + Aurora の組み合わせでのタイムアウトについて

Posted at

概要

MariaDB Connector/J で Aurora (jdbc:mysql:aurora://~) に接続する際は、SocketTimeout が 10 秒がデフォルト値であることに注意する事

事の発端

昨日に引き続き、MariaDB Connector/J と Aurora (MySQL) のお話
MySQL Connector/J から MariaDB Connector/J に変更し、ちょっと長めの SQL を投げた

その時、エラーが!!

2018-11-06 16:00:24,925 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-4) (conn=114228) Communications link failure with primary host hogehoge.ap-northeast-1.rds.amazonaws.com:3306. Connection timed out.  Driver has reconnect connection

なんじゃこりゃ?
と思い、MySQL Connector/J に戻すと事象が発生しない
ということは、MariaDB Connector/J に変更したからか、と

調べてみた

とりあえず、公式サイトを見に行く

そしたら見事に書いてありましたよ
10 秒を超えるクエリは Exception 投げるってさ

Another difference is the option "socketTimeout" that defaults to 10 seconds, meaning that - if not changed - queries exceeding 10 seconds will throw exceptions.

ですので、ConnectionURLSocketTimeout を設定してあげましょう (ちゃんと公式サイト読もうね)

仲間募集中

弊社ではエンジニアを募集中です。インフラからアプリ、ユーザサポートまで幅広く業務を行ってます。
https://www.nittsu-infosys.com/recruit/2019/index.html

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