목차

MySQL JDBC

Schema

> You're correct. For legacy reasons (including compatibility with ODBC, and SQL Server), JDBC's concept of "catalog" maps to MySQL's concept of "databases". 
> Starting in MySQL-4.1, "schema" is an alias for "database", but it doesn't act like a SQL-standard schema, so we don't support the concept in the JDBC driver. 

PreparedStatement 분석

addBatch

fetchSize

useSSL=false / sslMode=DISABLED

Datetime 0

zeroDateTimeBehavior
What should happen when the driver encounters DATETIME values
that are composed entirely of zeros (used by MySQL to represent invalid dates)?
Valid values are "exception", "round" and "convertToNull".
Default: exception 

Replication JDBC Driver

Sharding

MySQL JDBC Properties

connection/socket timeout

JDBC Query Log

sessionVariables

8.x

jdbc:mysql://[host:port]/[database]/?sessionVariables=&&key1=value1,key2=value2

7.x 이전

jdbc:mysql://[host:port]/[database]/?sessionVariables=key1=value1,key2=value2

allowMultiQueries

Interceptor

JDBC Driver 버전 정보 확인

// 이 코드의 클래스는 package가 com.mysql.jdbc
// Mockito.mock 사용
DatabaseMetaData metaData = new DatabaseMetaData(mock(MySQLConnection.class), null);
log.info("Version : {}, {}", metaData.getDriverName(), metaData.getDriverVersion());

com.mysql.jdbc.Driver 클래스에도 getMajorVersion(), getMinorVersion() 메소드가 있지만 마지막 subMinorVersion을 알 수 있는 방법은 없다.

Ping Validation

JDBC Type

tinyint(1)

JDBC Driver의 tinyInt1isBit=true 일 경우(기본값이 true임), tinyint(1)을 JDBC 드라이버에서 Boolean으로 리턴한다.