SlideShare a Scribd company logo
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
MySQL Connector/J 8.0 Feature Review
and How to Upgrade from Connector/J 5.1
Connector/J Developer and Team Lead
MySQL Middleware and Clients
September 17, 2019
Filipe Silva
The following is intended to outline our general product direction. It is intended for information purposes
only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing decisions. The development,
release, timing, and pricing of any features or functionality described for Oracle’s products may change
and remains at the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed
discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and
Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q
under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website
at http://www.oracle.com/investor. All information in this presentation is current as of September 2019
and Oracle undertakes no duty to update any statement in light of new information or future events.
Safe Harbor
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Filipe Silva
Connector/J Developer and Team Lead
MySQL Middleware and Clients
September 19, 2019
filipe.silva@oracle.com
Feature Review
// Topic: 1
// Topic: 2
// Topic: 3
// Topic: 4
From Connector/J 5.1 to 8.0
Copyright © 2019 Oracle and/or its affiliates.
MySQL Connector/J Overview
Installing and Using Connector/J
Features Showcase
Multi-host Connections
// Topic: 5
// Topic: 6
// Topic: 7
// Topic: 8
What changed?
The Time Zones Conundrum
X DevAPI Sneak Peek
Closing Comments, Q & A
Copyright © 2019 Oracle and/or its affiliates.
Feature Review
With more than two decades old,
MySQL Connector/J is still MySQL’s
flagship connector for Java
programming language, now
combining the traditional JDBC API and
the new X DevAPI in one single driver.
Let’s get started with the
basics
Copyright © 2019 Oracle and/or its affiliates.
MySQL Connector/J
Overview
 MySQL Connector/J story starts in 1998, by the crafty hands of
Mark Matthews, it’s creator and lead developer for many years.
 Currently, MySQL develops and maintains two Connector/J
versions – 8.0 and 5.1
 Open source hosted in GitHub
 https://github.com/mysql/mysql-connector-j
 Binaries are available in MySQL downloads page and maven
Central Repository
 Connector/J 8.0 is GA and the recommended version
Copyright © 2019 Oracle and/or its affiliates.
Some History and Facts
 Available since Apr. 2007
 Type 4 JDBC driver
 Compliant with JDBC 4.2 (Java 8.0)
 Requires Java 5 or above
 Supports MySQL Protocol
 Compatible with MySQL 5.1 and above
Copyright © 2019 Oracle and/or its affiliates.
MySQL Connector/J 5.1
 Available since Aug. 2015
 Type 4 JDBC driver
 Compliant with JDBC 4.2 (Java 8.0)
 Requires Java 8 or above
 Supports MySQL Protocol and X Protocol
 Implements the X DevAPI
 Compatible with MySQL 5.5 and above
Copyright © 2019 Oracle and/or its affiliates.
MySQL Connector/J 8.0
Copyright © 2019 Oracle and/or its affiliates.
Compatible with
[Java 8]
Java 9+
Supports
MySQL
5.5
MySQL
5.6
MySQL
5.7
MySQL
8.0 incl.
X Protocol
Connector/J 8.0
Compatible with
[Java 5]
Java 6
Java 7
[Java 8]
Java 9+
Supports
MySQL
5.1
MySQL
5.5
MySQL
5.6
MySQL
5.7
MySQL
8.0
Connector/J 5.1
Side-by-side
[Java n] – Required for compiling
Copyright © 2019 Oracle and/or its affiliates.
Installing and
Using Connector/J
Copyright © 2019 Oracle and/or its affiliates.
 MySQL Connector/J depends on Google’s protobuf java library
for compiling and for running X DevAPI code
 Java applications using the X DevAPI via Connector/J 8.0.17 must
have at least the following libraries in their Classpath:
 mysql-connector-java-8.0.17.jar
 protobuf-java-3.6.1.jar
 Installations via Linux packages or Windows installer require manual download:
 https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.6.1/
 Maven enabled projects manage and download all dependencies
automatically
Library Dependencies
Copyright © 2019 Oracle and/or its affiliates.
 Download from the official MySQL Downloads page:
 https://dev.mysql.com/downloads/connector/j/8.0.html
 Portable library bundle
 Linux packages and Windows installer
 Configure as a maven dependency
 https://search.maven.org/artifact/mysql/mysql-connector-
java/8.0.17/jar
“Installing” MySQL Connector/J Library
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
</dependency>
Copyright © 2019 Oracle and/or its affiliates.
 Customized builds and testing Connector/J code
 Required tools:
 Git client; Apache Ant 1.8.2+; JDK 8+
 Required third-party libraries:
 Junit 4.12+; Javassist 3.19+; Protcol Buffers Java API 3.6.1; C3P0 0.9.1;
JBoss common JDBC wrapper 3.2.3; Simple Logging Facade API 1.6.1
 Compile:
“Installing” from Source
$ git clone --branch release/8.0 
https://github.com/mysql/mysql-connector-j.git
$ ant -Dcom.mysql.cj.build.jdk=<path_to_jdk_1.8> 
-Dcom.mysql.cj.extra.libs=<path_to_libraries> dist
Connector/J packs loaded
with non-standard features
that can be enabled or tuned
via connection string options.
Here are some of them.
Copyright © 2019 Oracle and/or its affiliates.
Features Showcase
Copyright © 2019 Oracle and/or its affiliates.
User-defined key:value pairs that get stored into
P_S.SESSION_CONNECT_ATTRS
JDBC 4.0’s Connection.get/setClientInfo()
implementation; appends info data as query
comments by default
Instead of failing, creates the database identified in the
connection string if it doesn’t exist
Switch between CATALOG and SCHEMA to define
what Connection or MetaData methods and
arguments will used when referring to a database
connectionAttributes
clientInfoProvider
createDatabaseIfNotExist
databaseTerm
General Properties
Copyright © 2019 Oracle and/or its affiliates.
Monitor and act on connection creation, destruction,
commit, rollback and more, potentially altering the
execution of these commands
Ability to influence queries and Statement objects
prior to their execution and modify results afterwards
Exceptions thrown by the driver can be intercepted
upon their creation giving the user the ability to inject
side effects when errors occur
connectionLifecycleInterceptors
queryInterceptors
exceptionInterceptors
User-defined Interceptors
Copyright © 2019 Oracle and/or its affiliates.
List of the classes implementing the interface
AuthenticationPlugin for custom or redefined
authentication workflow
Define what authentication plugin to use as default
when the server suggests an unsupported one
Authentication plugins not allowed in the connection
Should an expired password cause connection close or
open in sandbox mode, allowing to reset the pwd
What character encoding to use in the password
authenticationPlugins
defaultAuthenticationPlugin
disabledAuthenticationPlugins
disconnectOnExpiredPasswords
passwordCharacterEncoding
On Authentication
Copyright © 2019 Oracle and/or its affiliates.
Sets the given list of key=value pairs as session
variables once the connection is established
The character encoding to use when dealing with
strings; by default detects the server’s character set
The character set should use on results
Sets the server character set and collation; overrides
characterEncoding
sessionVariables
characterEncoding
characterSetResults
connectionCollation
Session Specific
Copyright © 2019 Oracle and/or its affiliates.
The name of the class the that creates client sockets;
can be used to change default socket behavior, e.g.,
use proxies, firewall or replace by Unix Domain Sockets
The time the client is willing to wait on socket connect
and reads, respectively
The maximum size protocol packet can have
Enable protocol packets compression
Name or IP address of the SOCKS host to connect
through and its corresponding port
socketFactory
connectTimeout/socketTimeout
maxAllowedPacket
useCompression
socksProxyHost/socksProxyPort
Network Tweaking
Copyright © 2019 Oracle and/or its affiliates.
Enables multiple queries in a single statement
execution; may return multiple ResultSets; doesn’t
affect batched statements
Batched statement execution continues even in case
of errors
Sets the option to kill the connection instead of
canceling the query in case of execution timeout
Allows disabling escape codes in queries
allowMultiQueries
continueBatchOnError
queryTimeoutKillsConnection
enableEscapeProcessing
Related to Statements
Copyright © 2019 Oracle and/or its affiliates.
Switches between server-side prepared statements or
client-side emulation of prepared statements
Fall-back to client-side prepared statements when
preparing server-side prepared statements fails
Allows disabling escape codes in queries that are
prepared
useServerPrepStmts
emulateUnsupportedPstmts
processEscapeCodesForPrepStmts
Related to Prepared Statements
Copyright © 2019 Oracle and/or its affiliates.
Empty strings are converted to 0 or throw an
exception when read as number
Allow keeping result sets open after statement close
The maximum number of rows to return from the
statements running on this connection
Pad CHAR type columns with spaces, up to their size
emptyStringsConvertToZero
holdResultsOpenOverStatementClose
maxRows
padCharsWithSpace
Related to Result Sets
Copyright © 2019 Oracle and/or its affiliates.
Switch between using INFORMATION_SCHEMA and
getting meta data from MYSQL schema and SHOW
Indicates if DatabaseMetaData.getProcedures()
and similar should return metadata for both stored
procedures and functions or just stored procedures
When searching metadata, a null value in catalog or
schemaPattern means current database or doesn’t
apply the filter; see also databaseTerm
useInformationSchema
getProceduresReturnsFunctions
nullDatabaseMeansCurrent
Related to Metadata
Copyright © 2019 Oracle and/or its affiliates.
Set how connections must be secured: DISABLED,
PREFERRED, REQUIRED, VERIFY_CA, VERIFY_IDENTITY
The list of TLS protocols to allow: TLS_V1 - TLS_V1.2
The list of cipher suites to allow
Set of key store details for trust certificates
Set of key store details for client certificates
Enables getting server’s public key through the wire
Enables queries using LOAD DATA LOCAL INFILE
sslMode
enabledTLSProtocols
enabledSSLCipherSuites
trustCertificateKeyStore*
clientCertificateKeyStore*
allowPublicKeyRetrieval
allowLoadLocalInfile
On Securing Connections
Copyright © 2019 Oracle and/or its affiliates.
State what time zone the server is in when doing all
date time conversions
Define what to do when MySQL returns all-zero date
time values: EXCEPTION, ROUND or CONVERT_TO_NULL
Truncate fractional seconds part when setting date
time values
Treat the MySQL type YEAR as Date or as short
serverTimezone
zeroDateTimeBehavior
sendFractionalSeconds
yearIsDateType
Date-time Processing
Copyright © 2019 Oracle and/or its affiliates.
Keep a session state local reference for auto-commit
and transaction isolation values to reduce the number
of transaction handling queries to send
Cache server variables and collation data from first
connection for using in the following connections
Either always send or only if different, transaction
isolation settings, in Connection.setTransactionIsolation()
Either always send or only if different, session auto-
commit settings, in Connection.setAutocommit()
useLocalSessionState
cacheServerConfiguration
alwaysSendSetIsolation
elideSetAutoCommits
Tweaking Performance/1
Copyright © 2019 Oracle and/or its affiliates.
Sets server-side read-only state or manages it entirely
on client-side
Cache the parsing stage of client-side prepared
statements and server-prepared statements instances
Rewrite batched inserts efficiently and/or use multi-
queries to reduce the number of queries to send
Combined with Statement.setFetchSize()
instructs the server to user cursor based server-side
prepared statements executions
readOnlyPropagatesToServer
cachePrepStmts
rewriteBatchedStatements
useCursorFetch
Tweaking Performance/2
Copyright © 2019 Oracle and/or its affiliates.
Class name that implements a log interface
Trace and log queries and their execution time
Log queries that take longer than a set threshold
Instead of checking the execution time against a
threshold, log the ones outside the 99th percentile
When slow queries are logged, also include their
execution plan
Log protocol packets as Hex dumps into the log
Logger
profileSQL
logSlowQueries
autoSlowLog
explainSlowQueries
traceProtocol
Debug and Profiling
Fail-over, load-balancing,
replication-aware, … plenty
to choose from to achieve
improved high-availability
Copyright © 2019 Oracle and/or its affiliates.
Multi-host
Connections
 Support for logic Connection instances backed up by multiple MySQL
servers
 Underlying physical connections have their own sessions that cannot be
tracked, shared or copied
 Internal switches between physical connections mean switches between
sessions
 There are no physical connection switches within a transaction
boundary, switches occur only between transactions
 Three types of multi-host connections: failover, load-balancing and
replication-aware
Copyright © 2019 Oracle and/or its affiliates.
Multi-host Connections
 Connection-related errors trigger fail-over to a secondary host
 Connection errors are propagated to the client, that has to handle
them
 Fall-back to primary host occurs transparent and automatically,
based on:
 secondsBeforeRetryMaster – the time to wait before falling back
 queriesBeforeRetryMaster – number of queries before falling back
 With autoReconnect=true the same Statement objects can be
reused, otherwise new ones must be created
Copyright © 2019 Oracle and/or its affiliates.
Fail-over Connections
jdbc:mysql://primary:port,secondary1:port,secondary2:port,.../database?props...
 Load is distributed among the listed hosts based on customizable load-balancing
strategies - ha.loadBalanceStrategy:
 Pre-defined: random, bestResponseTime and serverAffinity (pairs with serverAffinityOrder)
 Custom made: implementation of com.mysql.cj.jdbc.JdbcConnection.BalanceStrategy
 Load balancing/fail-over occurs on:
 Transaction boundaries: explicit commit/rollback
 Connection exceptions: SQL State “08xxx”
 Conditions defined by user:
 loadBalanceSQLStateFailover, loadBalanceSQLExceptionSubclassFailover or loadBalanceExceptionChecker
 Auto-commit triggers:
 loadBalanceAutoCommitStatementThreshold and loadBalanceAutoCommitStatementRegex
 Hosts list can be managed through JMX and shared between connections
 loadBalanceConnectionGroup & ha.enableJMX
 Connection and transaction statistics, add/remove hosts
Copyright © 2019 Oracle and/or its affiliates.
Load-balancing Connections
jdbc:mysql:loadbalance://host1:port,host2:port,host3:port,.../database?props...
 Connections are initialized with two sub-connections:
 One load-balanced master(s) connection
 One load-balanced slaves connection
 Connection.setReadOnly() switches between masters and slaves sub-connections
 Replication-aware connections specific options:
 allowMasterDownConnections – use slaves if no masters or all down, on connection initialization
 allowSlavesDownConnections – use masters if no slaves or all down, on connection initialization
 readFromMasterWhenNoSlaves – user the masters connection, in read-only, if no slaves or all down
 Support for multi-master replication topologies
 Hosts list can be managed through JMX and shared between connections
 replicationConnectionGroup & ha.enableJMX
 Connection and transaction statistics, add/remove hosts, promoting/demoting hosts, etc.
Copyright © 2019 Oracle and/or its affiliates.
Replication-aware Connections
jdbc:mysql:replication://master:port,slave1:port,slave2:port,.../database?props...
Copyright © 2019 Oracle and/or its affiliates.
From Connector/J 5.1 to 8.0
With progress comes change, with
change comes sacrifice. Not all
decisions were easily made, but we
believe we did them for our users
benefit.
From minimum JVM version
8 to new temporal data
handling defaults, sometimes
upgrading is not just a drop-
in replacement.
Copyright © 2019 Oracle and/or its affiliates.
What changed?
Copyright © 2019 Oracle and/or its affiliates.
 Runs on Java 8; users are advised to check the Java incompatibility
information, provided by Oracle, before upgrading
 Improved connection strings syntax
 Several connection properties were removed, a few renamed and
some added
 Major code refactoring and overhaul for improved performance
 Packages structure changed entirely, some classes were deprecated
 Exceptions updated to match JDBC standard
 Default temporal data types changed regarding time zones handling
 Ant build and testing procedures were restructured
Overall Changes
Copyright © 2019 Oracle and/or its affiliates.
 New scheme – mysqlx: – for X DevAPI sessions
 Authority section of connection strings (user and hosts information)
supports multiple syntaxes:
 The {host} part can be written as:
 IPv6 addresses must be written between square brackets: [::1]
Improved Connection Strings
scheme://[usr[:pwd]@]{host},[usr[:pwd]@][{host},{host},...],.../db?key=value&...
hostOrIP:portNumber
address=(host=hostOrIP)(port=portNumber)(key=value)(...)
(host=hostOrIP,port=portNumber,key=value,...)
(address=hostOrIP:portNumber,key=value,...)
Copyright © 2019 Oracle and/or its affiliates.
 Legacy Date and Time handling:
 dynamicCalendars, noTzConversionForTimeType,
noTzConversionForDateType, cacheDefaultTimezone,
useFastIntParsing, useFastDateParsing,
useJDBCCompliantTimezoneShift, useLegacyDatetimeCode,
useSSPSCompatibleTimezoneShift, useTimezone,
useGmtMillisForDatetimes
 Connection properties removed:
 useBlobToStoreUTF8OutsideBMP,
utf8OutsideBmpExcludedColumnNamePattern, and
utf8OutsideBmpIncludedColumnNamePattern – utf8mb4 is now
supported in all maintained MySQL versions
Changes in Connection Properties/1
Copyright © 2019 Oracle and/or its affiliates.
 Connection properties removed:
 useDynamicCharsetInfo – no more cached custom charset mappings
 useJvmCharsetConverters – JVM charsets now used in all cases
 dumpMetadataOnColumnNotFound – redundant feature
 relaxAutoCommit – for MySQL versions with no transactions support
 strictFloatingPoint – was used on deprecated test suite
 runningCTS13 – was used on deprecated test suite
 retainStatementAfterResultSetClose – not JDBC compliant
 nullNamePatternMatchesAll – not JDBC compliant
Changes in Connection Properties/2
Copyright © 2019 Oracle and/or its affiliates.
 Main package is now com.mysql.cj.jdbc
 Entry class Driver moved from com.mysql.jdbc.Driver to
com.mysql.cj.jdbc.Driver; old one was deprecated
 Commonly used interfaces that moved:
Changes in the Connector/J API/1
com.mysql.jdbc.ExceptionInterceptor com.mysql.cj.exceptions.ExceptionInterceptor
com.mysql.jdbc.StatementInterceptorV2 com.mysql.cj.interceptors.QueryInterceptor
com.mysql.jdbc.
ConnectionLifecycleInterceptor
com.mysql.cj.jdbc.interceptors.
ConnectionLifecycleInterceptor
Copyright © 2019 Oracle and/or its affiliates.
 Commonly used interfaces that moved (continuation):
Changes in the Connector/J API/2
com.mysql.jdbc.AuthenticationPlugin com.mysql.cj.protocol.AuthenticationPlugin
com.mysql.jdbc.jdbc2.optional.
MysqlDataSource
com.mysql.cj.jdbc.MysqlDataSource
com.mysql.jdbc.jdbc2.optional.
MysqlDataSourceFactory
com.mysql.cj.jdbc.MysqlDataSourceFactory
com.mysql.jdbc.jdbc2.optional.
MysqlConnectionPoolDataSource
com.mysql.cj.jdbc.
MysqlConnectionPoolDataSource
com.mysql.jdbc.jdbc2.optional.
MysqlXADataSource
com.mysql.cj.jdbc.MysqlXADataSource
com.mysql.jdbc.jdbc2.optional.MysqlXid com.mysql.cj.jdbc.MysqlXid
Not only changes in package names but also on methods signatures
Copyright © 2019 Oracle and/or its affiliates.
 Most exceptions were duplicated before:
 Pre-JDBC 4 versions in package com.mysql.jdbc.exceptions
 Post-JDBC 4 versions in package com.mysql.jdbc.exceptions.jdbc4
 Due to multi-JVM and multi-JDBC support in Connector/J
 Duplicated exceptions are now merged in one
 All Connector/J exceptions extend or were replaced by the
corresponding standard JDBC exceptions
Changes in Exceptions/1
Copyright © 2019 Oracle and/or its affiliates.
com.mysql.jdbc.exceptions.jdbc4.
CommunicationsException
com.mysql.cj.jdbc.exceptions.
CommunicationsException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLDataException
java.sql.SQLDataException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLIntegrityConstraintViolationException
java.sql.
SQLIntegrityConstraintViolationException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLInvalidAuthorizationSpecException
java.sql.SQLInvalidAuthorizationSpecException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLNonTransientConnectionException
java.sql.SQLNonTransientConnectionException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLNonTransientException
java.sql.SQLNonTransientException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLQueryInterruptedException
com.mysql.cj.jdbc.exceptions.
MySQLQueryInterruptedException
Changes in Exceptions/2
Copyright © 2019 Oracle and/or its affiliates.
com.mysql.jdbc.exceptions.
MySQLStatementCancelledException
com.mysql.cj.jdbc.exceptions.
MySQLStatementCancelledException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLSyntaxErrorException
java.sql.SQLSyntaxErrorException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLTimeoutException
java.sql.SQLTimeoutException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLTransactionRollbackException
java.sql.SQLTransactionRollbackException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLTransientConnectionException
java.sql.SQLTransientConnectionException
com.mysql.jdbc.exceptions.[jdbc4.]
MySQLTransientException
java.sql.SQLTransientException
m.mysql.jdbc.exceptions.[jdbc4.]
MySQLIntegrityConstraintViolationException
java.sql.
SQLIntegrityConstraintViolationException
Changes in Exceptions/3
For a long time the lack of
support for time-zone
information in date-time values
has been causing problems for
many. It isn’t fixed yet, but we
hope we are a step closer.
Copyright © 2019 Oracle and/or its affiliates.
The Time Zones
Conundrum
Use Case
Clients in different time zones store and read a DATETIME value that doesn’t carry TZ information
Client 1
TZ: UTC-7
Client 2
TZ: UTC+1
Client 3
TZ: UTC-4
Backend Systems
Application
Server
TZ: irrelevant
Data
Store
TZ: UTC-4
MySQL
TZ: System
Copyright © 2019 Oracle and/or its affiliates.
2019-09-19 11:50:002019-09-19 11:50:00
2019-09-19 14:50:002019-09-19 14:50:00
2019-09-19 19:50:00
2019-09-19 14:50:002019-09-19 14:50:00
 MySQL doesn’t support time zone info in date-time values
 By default Connector/J discovers the server time zone:
 By default MySQL server refers to system time zone, that mostly uses
abbreviations
 Time zone abbreviations aren’t deterministic
 “The server time zone value 'PDT' is unrecognized or represents more than one
time zone.”
 Client has to set what is the target and source time zone when
storing and retrieving temporal data, respectively
 Time zones that observe DST have time gaps and overlaps
Copyright © 2019 Oracle and/or its affiliates.
So, what’s the problem?
 All temporal data in PreparedStatment getters and setters
are subject to time zone adjustments
 Client application has to choose:
1. Adjust to server time zone when stored and adjust back to the client time
zone when loaded  default or serverTimezone=<server_TZ>
2. Store and read as-is, i.e., no time zone adjustment 
serverTimezone=<client_TZ>
3. Adjust to/from a neutral time zone  serverTimezone=UTC
 Recommendation is to set neutral TZ, w/o DST, adjustments
Copyright © 2019 Oracle and/or its affiliates.
Date-time Handling Policies in
Connector/J 8.0
Are you ready new database
programming API? Give it a
try and experiment the
MySQL X DevAPI.
Copyright © 2019 Oracle and/or its affiliates.
X DevAPI Sneak
Peek
Copyright © 2019 Oracle and/or its affiliates.
 Synchronous and Asynchronous
operation executions
 Secure by default (TLS+SHA2)
 Transactions, save points and
row-locking
 Auto-magic prepared
statements
 Connection pooling and fail-
over
 Integrated in the MySQL Shell
 Enables MySQL Document Store
to client applications
 Offers schema-less data storage
development
 Fluent API
 Programming language agnostic
 Intuitive CRUD methods
 Raw SQL also available
 Domain specific expression
language
X DevAPI Key Features
Copyright © 2019 Oracle and/or its affiliates.
X
DevAPI
CRUD
X
DevAPI
SQL
JDBCX DevAPI Sneak Peek
Side by Side: JDBC/1
Connection conn = DriverManager
.getConnection("jdbc:mysql://localhost/alcatraz", "demousr", "demopwd");
Statement stmt = conn.createStatement();
stmt.execute("CREATE TABLE facilities (id INT AUTO_INCREMENT PRIMARY KEY, "
+ "designation VARCHAR(100), capacity INT)");
PreparedStatement pstmt = conn
.prepareStatement("INSERT INTO facilities VALUES (NULL, ?, ?)");
pstmt.setString(1, "B-206"); pstmt.setInt(2, 1); pstmt.execute();
pstmt.setString(1, "Mess Hall"); pstmt.setInt(2, 250); pstmt.execute();
pstmt.close();
Copyright © 2019 Oracle and/or its affiliates.
X
DevAPI
CRUD
X
DevAPI
SQL
JDBCX DevAPI Sneak Peek
Side by Side: JDBC/2
rs = stmt.executeQuery("SELECT * FROM facilities");
while (rs.next()) {
System.out.printf("%d: %s (%d)%n", rs.getInt(1), rs.getString(2),
rs.getInt(3));
}
| 1: B-206 (1)
| 2: Mess Hall (250)
stmt.execute("DROP TABLE facilities");
stmt.close(); conn.close();
Copyright © 2019 Oracle and/or its affiliates.
X
DevAPI
CRUD
X
DevAPI
SQL
JDBCX DevAPI Sneak Peek
Side by Side: X DevAPI Raw SQL/1
SessionFactory sf = new SessionFactory();
Session sess = sf.getSession("mysqlx://demousr:demopwd@localhost:33060/alcatraz");
sess.sql("CREATE TABLE facilities (id INT AUTO_INCREMENT PRIMARY KEY, "
+ "designation VARCHAR(100), capacity INT)").execute();
SqlStatement stmt = sess.sql("INSERT INTO facilities VALUES (NULL, ?, ?)");
stmt.bind(Arrays.asList("B-206", 1)).execute();
stmt.clearBindings().bind(Arrays.asList("Mess Hall", 250)).execute();
Copyright © 2019 Oracle and/or its affiliates.
X
DevAPI
CRUD
X
DevAPI
SQL
JDBCX DevAPI Sneak Peek
Side by Side: X DevAPI Raw SQL/2
sess.sql("SELECT * FROM facilities").execute().forEach(r -> System
.out.printf("%d: %s (%d)%n", r.getInt(0), r.getString(1), r.getInt(2)));
| 1: B-206 (1)
| 2: Mess Hall (250)
sess.sql("DROP TABLE facilities").execute();
sess.close();
Copyright © 2019 Oracle and/or its affiliates.
X
DevAPI
CRUD
X
DevAPI
SQL
JDBCX DevAPI Sneak Peek
Side by Side: X DevAPI CRUD/1
SessionFactory sf = new SessionFactory();
Session sess = sf.getSession("mysqlx://demousr:demopwd@localhost:33060/alcatraz");
sess.sql("CREATE TABLE facilities (id INT AUTO_INCREMENT PRIMARY KEY, "
+ "designation VARCHAR(100), capacity INT)").execute();
Table tbl = schm.getTable("facilities");
tbl.insert("designation", "capacity").values("B-206", 1).values("Mess Hall", 250)
.execute();
Copyright © 2019 Oracle and/or its affiliates.
X
DevAPI
CRUD
X
DevAPI
SQL
JDBCX DevAPI Sneak Peek
Side by Side: X DevAPI CRUD/2
tbl.select().execute().forEach(r -> System
.out.printf("%d: %s (%d)%n", r.getInt(0), r.getString(1), r.getInt(2)));
| 1: B-206 (1)
| 2: Mess Hall (250)
sess.sql("DROP TABLE facilities").execute();
sess.close();
Let’s wrap this up…
Copyright © 2019 Oracle and/or its affiliates.
Closing Comments,
Q & A
 Use MySQL Connector/J 8.0, MySQL Connector/J 5.1 may be
EOLed at any time
 Extensive connection options set; consult the documentation
 Built-in support for multi-host connections
 MySQL Connector/J 8.0:
 Is GA and the recommend version to use
 Runs on Java 8 and above
 Complete refactoring and overhaul
 More consistency in vendor custom APIs
 JDBC for MySQL and MySQL Document Store support in same driver
 X DevAPI out-of-the-box
Copyright © 2019 Oracle and/or its affiliates.
Closing Comments
Q & A
https://dev.mysql.com
Copyright © 2019 Oracle and/or its affiliates.
The preceding is intended to outline our general product direction. It is intended for information purposes
only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing decisions. The development,
release, timing, and pricing of any features or functionality described for Oracle’s products may change
and remains at the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed
discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and
Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q
under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website
at http://www.oracle.com/investor. All information in this presentation is current as of September 2019
and Oracle undertakes no duty to update any statement in light of new information or future events.
Safe Harbor
Copyright © 2019 Oracle and/or its affiliates.
Session Survey
Help us make the content
even better. Please complete
the session survey in the
Mobile App.
Copyright © 2019 Oracle and/or its affiliates.
Thank You
Copyright © 2019 Oracle and/or its affiliates.
Connector/J Developer and Team Lead
MySQL Middleware and Clients
September 17, 2019
Filipe Silva

More Related Content

What's hot

GlassFish BOF
GlassFish BOFGlassFish BOF
GlassFish BOF
glassfish
 
Con8493 simplified ui 2013 tailoring dubois_evers_teter_o'broin_uob_partner
Con8493 simplified ui 2013 tailoring dubois_evers_teter_o'broin_uob_partnerCon8493 simplified ui 2013 tailoring dubois_evers_teter_o'broin_uob_partner
Con8493 simplified ui 2013 tailoring dubois_evers_teter_o'broin_uob_partner
Berry Clemens
 
Salesforce Auckland Developer Meetup - May 2018 - Lightning Web Components
Salesforce Auckland Developer Meetup - May 2018 - Lightning Web Components Salesforce Auckland Developer Meetup - May 2018 - Lightning Web Components
Salesforce Auckland Developer Meetup - May 2018 - Lightning Web Components
Ben Edwards
 
JDK versions and OpenJDK
JDK versions and OpenJDKJDK versions and OpenJDK
JDK versions and OpenJDK
Wolfgang Weigend
 
Con8289 r12 maintenance tips heisler heisler-con8289
Con8289 r12 maintenance tips heisler heisler-con8289Con8289 r12 maintenance tips heisler heisler-con8289
Con8289 r12 maintenance tips heisler heisler-con8289
Berry Clemens
 
Ugf9796 weblogic for ebs and obiee
Ugf9796 weblogic for ebs and obieeUgf9796 weblogic for ebs and obiee
Ugf9796 weblogic for ebs and obiee
Berry Clemens
 
Con11257 schifano con11257-best practices for deploying highly scalable virtu...
Con11257 schifano con11257-best practices for deploying highly scalable virtu...Con11257 schifano con11257-best practices for deploying highly scalable virtu...
Con11257 schifano con11257-best practices for deploying highly scalable virtu...
Berry Clemens
 
Whats new in Primavera Prime 15.2?
Whats new in Primavera Prime 15.2?Whats new in Primavera Prime 15.2?
Whats new in Primavera Prime 15.2?
p6academy
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Aditya Jha
 
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
Fred Rowe
 
It's a jdk jungle out there - JDK 11 and OpenJDK 11
It's a jdk jungle out there - JDK 11 and OpenJDK 11It's a jdk jungle out there - JDK 11 and OpenJDK 11
It's a jdk jungle out there - JDK 11 and OpenJDK 11
Wolfgang Weigend
 
Oracle mobile cloud service
Oracle mobile cloud serviceOracle mobile cloud service
Oracle mobile cloud service
shravan kumar chelika
 
Con9437 ad ffor_ebs and mobile
Con9437 ad ffor_ebs and mobileCon9437 ad ffor_ebs and mobile
Con9437 ad ffor_ebs and mobile
Berry Clemens
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
anil_kumar132001
 
Building Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationBuilding Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integration
Fredrik Öhrström
 
JavaFX 2 - A Java Developer's Guide (San Antonio JUG Version)
JavaFX 2 - A Java Developer's Guide (San Antonio JUG Version)JavaFX 2 - A Java Developer's Guide (San Antonio JUG Version)
JavaFX 2 - A Java Developer's Guide (San Antonio JUG Version)
Stephen Chin
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
Mert Çalışkan
 
JDK 10 Java Module System
JDK 10 Java Module SystemJDK 10 Java Module System
JDK 10 Java Module System
Wolfgang Weigend
 
Newfeaturesincontext 130911052709-phpapp01
Newfeaturesincontext 130911052709-phpapp01Newfeaturesincontext 130911052709-phpapp01
Newfeaturesincontext 130911052709-phpapp01
Frank Rodriguez
 
Con3928 horton session con3928 fusion app on-premise installation lessons lea...
Con3928 horton session con3928 fusion app on-premise installation lessons lea...Con3928 horton session con3928 fusion app on-premise installation lessons lea...
Con3928 horton session con3928 fusion app on-premise installation lessons lea...
Berry Clemens
 

What's hot (20)

GlassFish BOF
GlassFish BOFGlassFish BOF
GlassFish BOF
 
Con8493 simplified ui 2013 tailoring dubois_evers_teter_o'broin_uob_partner
Con8493 simplified ui 2013 tailoring dubois_evers_teter_o'broin_uob_partnerCon8493 simplified ui 2013 tailoring dubois_evers_teter_o'broin_uob_partner
Con8493 simplified ui 2013 tailoring dubois_evers_teter_o'broin_uob_partner
 
Salesforce Auckland Developer Meetup - May 2018 - Lightning Web Components
Salesforce Auckland Developer Meetup - May 2018 - Lightning Web Components Salesforce Auckland Developer Meetup - May 2018 - Lightning Web Components
Salesforce Auckland Developer Meetup - May 2018 - Lightning Web Components
 
JDK versions and OpenJDK
JDK versions and OpenJDKJDK versions and OpenJDK
JDK versions and OpenJDK
 
Con8289 r12 maintenance tips heisler heisler-con8289
Con8289 r12 maintenance tips heisler heisler-con8289Con8289 r12 maintenance tips heisler heisler-con8289
Con8289 r12 maintenance tips heisler heisler-con8289
 
Ugf9796 weblogic for ebs and obiee
Ugf9796 weblogic for ebs and obieeUgf9796 weblogic for ebs and obiee
Ugf9796 weblogic for ebs and obiee
 
Con11257 schifano con11257-best practices for deploying highly scalable virtu...
Con11257 schifano con11257-best practices for deploying highly scalable virtu...Con11257 schifano con11257-best practices for deploying highly scalable virtu...
Con11257 schifano con11257-best practices for deploying highly scalable virtu...
 
Whats new in Primavera Prime 15.2?
Whats new in Primavera Prime 15.2?Whats new in Primavera Prime 15.2?
Whats new in Primavera Prime 15.2?
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...
 
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
 
It's a jdk jungle out there - JDK 11 and OpenJDK 11
It's a jdk jungle out there - JDK 11 and OpenJDK 11It's a jdk jungle out there - JDK 11 and OpenJDK 11
It's a jdk jungle out there - JDK 11 and OpenJDK 11
 
Oracle mobile cloud service
Oracle mobile cloud serviceOracle mobile cloud service
Oracle mobile cloud service
 
Con9437 ad ffor_ebs and mobile
Con9437 ad ffor_ebs and mobileCon9437 ad ffor_ebs and mobile
Con9437 ad ffor_ebs and mobile
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
 
Building Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationBuilding Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integration
 
JavaFX 2 - A Java Developer's Guide (San Antonio JUG Version)
JavaFX 2 - A Java Developer's Guide (San Antonio JUG Version)JavaFX 2 - A Java Developer's Guide (San Antonio JUG Version)
JavaFX 2 - A Java Developer's Guide (San Antonio JUG Version)
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
 
JDK 10 Java Module System
JDK 10 Java Module SystemJDK 10 Java Module System
JDK 10 Java Module System
 
Newfeaturesincontext 130911052709-phpapp01
Newfeaturesincontext 130911052709-phpapp01Newfeaturesincontext 130911052709-phpapp01
Newfeaturesincontext 130911052709-phpapp01
 
Con3928 horton session con3928 fusion app on-premise installation lessons lea...
Con3928 horton session con3928 fusion app on-premise installation lessons lea...Con3928 horton session con3928 fusion app on-premise installation lessons lea...
Con3928 horton session con3928 fusion app on-premise installation lessons lea...
 

Similar to MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1

Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Frederic Descamps
 
Python and MySQL 8.0 Document Store
Python and MySQL 8.0 Document StorePython and MySQL 8.0 Document Store
Python and MySQL 8.0 Document Store
Frederic Descamps
 
Node.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesNode.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development Techniques
Christopher Jones
 
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/NetMySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
Mark Swarbrick
 
Jakarta EE: Today and Tomorrow
Jakarta EE: Today and TomorrowJakarta EE: Today and Tomorrow
Jakarta EE: Today and Tomorrow
Dmitry Kornilov
 
MySQL Connector/J in the Making of Modern Applications
MySQL Connector/J in the Making of Modern ApplicationsMySQL Connector/J in the Making of Modern Applications
MySQL Connector/J in the Making of Modern Applications
Filipe Silva
 
B1 roadmap to cloud platform with oracle web logic server-oracle coherence ...
B1   roadmap to cloud platform with oracle web logic server-oracle coherence ...B1   roadmap to cloud platform with oracle web logic server-oracle coherence ...
B1 roadmap to cloud platform with oracle web logic server-oracle coherence ...
Dr. Wilfred Lin (Ph.D.)
 
Marcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL WorkbenchMarcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL Workbench
Women in Technology Poland
 
How to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL ShellHow to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL Shell
Frederic Descamps
 
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
Mohamedcpcbma
 
JavaScript: Why Should I Care?
JavaScript: Why Should I Care?JavaScript: Why Should I Care?
JavaScript: Why Should I Care?
Daniel McGhan
 
Confoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetConfoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSet
Dave Stokes
 
Oracle CloudWorld 2023 - How to hook up Telegram with Spring Boot and ADB
Oracle CloudWorld 2023 - How to hook up Telegram with Spring Boot and ADBOracle CloudWorld 2023 - How to hook up Telegram with Spring Boot and ADB
Oracle CloudWorld 2023 - How to hook up Telegram with Spring Boot and ADB
Juarez Junior
 
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
Frederic Descamps
 
General Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevGeneral Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajev
Oracle Developers
 
Java, app servers and oracle application grid
Java, app servers and oracle application gridJava, app servers and oracle application grid
Java, app servers and oracle application grid
Alicja Sieminska
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document Store
Dave Stokes
 
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
Frederic Descamps
 
Building Rich Applications with Appcelerator
Building Rich Applications with AppceleratorBuilding Rich Applications with Appcelerator
Building Rich Applications with Appcelerator
Matt Raible
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishJava API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Arun Gupta
 

Similar to MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1 (20)

Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
 
Python and MySQL 8.0 Document Store
Python and MySQL 8.0 Document StorePython and MySQL 8.0 Document Store
Python and MySQL 8.0 Document Store
 
Node.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesNode.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development Techniques
 
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/NetMySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
 
Jakarta EE: Today and Tomorrow
Jakarta EE: Today and TomorrowJakarta EE: Today and Tomorrow
Jakarta EE: Today and Tomorrow
 
MySQL Connector/J in the Making of Modern Applications
MySQL Connector/J in the Making of Modern ApplicationsMySQL Connector/J in the Making of Modern Applications
MySQL Connector/J in the Making of Modern Applications
 
B1 roadmap to cloud platform with oracle web logic server-oracle coherence ...
B1   roadmap to cloud platform with oracle web logic server-oracle coherence ...B1   roadmap to cloud platform with oracle web logic server-oracle coherence ...
B1 roadmap to cloud platform with oracle web logic server-oracle coherence ...
 
Marcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL WorkbenchMarcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL Workbench
 
How to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL ShellHow to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL Shell
 
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
 
JavaScript: Why Should I Care?
JavaScript: Why Should I Care?JavaScript: Why Should I Care?
JavaScript: Why Should I Care?
 
Confoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetConfoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSet
 
Oracle CloudWorld 2023 - How to hook up Telegram with Spring Boot and ADB
Oracle CloudWorld 2023 - How to hook up Telegram with Spring Boot and ADBOracle CloudWorld 2023 - How to hook up Telegram with Spring Boot and ADB
Oracle CloudWorld 2023 - How to hook up Telegram with Spring Boot and ADB
 
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
 
General Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevGeneral Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajev
 
Java, app servers and oracle application grid
Java, app servers and oracle application gridJava, app servers and oracle application grid
Java, app servers and oracle application grid
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document Store
 
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
 
Building Rich Applications with Appcelerator
Building Rich Applications with AppceleratorBuilding Rich Applications with Appcelerator
Building Rich Applications with Appcelerator
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishJava API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFish
 

Recently uploaded

UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 

Recently uploaded (20)

UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 

MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1

  • 1. Copyright © 2019 Oracle and/or its affiliates.
  • 2. Copyright © 2019 Oracle and/or its affiliates. MySQL Connector/J 8.0 Feature Review and How to Upgrade from Connector/J 5.1 Connector/J Developer and Team Lead MySQL Middleware and Clients September 17, 2019 Filipe Silva
  • 3. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Copyright © 2019 Oracle and/or its affiliates.
  • 4. Copyright © 2019 Oracle and/or its affiliates. Filipe Silva Connector/J Developer and Team Lead MySQL Middleware and Clients September 19, 2019 filipe.silva@oracle.com
  • 5. Feature Review // Topic: 1 // Topic: 2 // Topic: 3 // Topic: 4 From Connector/J 5.1 to 8.0 Copyright © 2019 Oracle and/or its affiliates. MySQL Connector/J Overview Installing and Using Connector/J Features Showcase Multi-host Connections // Topic: 5 // Topic: 6 // Topic: 7 // Topic: 8 What changed? The Time Zones Conundrum X DevAPI Sneak Peek Closing Comments, Q & A
  • 6. Copyright © 2019 Oracle and/or its affiliates. Feature Review With more than two decades old, MySQL Connector/J is still MySQL’s flagship connector for Java programming language, now combining the traditional JDBC API and the new X DevAPI in one single driver.
  • 7. Let’s get started with the basics Copyright © 2019 Oracle and/or its affiliates. MySQL Connector/J Overview
  • 8.  MySQL Connector/J story starts in 1998, by the crafty hands of Mark Matthews, it’s creator and lead developer for many years.  Currently, MySQL develops and maintains two Connector/J versions – 8.0 and 5.1  Open source hosted in GitHub  https://github.com/mysql/mysql-connector-j  Binaries are available in MySQL downloads page and maven Central Repository  Connector/J 8.0 is GA and the recommended version Copyright © 2019 Oracle and/or its affiliates. Some History and Facts
  • 9.  Available since Apr. 2007  Type 4 JDBC driver  Compliant with JDBC 4.2 (Java 8.0)  Requires Java 5 or above  Supports MySQL Protocol  Compatible with MySQL 5.1 and above Copyright © 2019 Oracle and/or its affiliates. MySQL Connector/J 5.1
  • 10.  Available since Aug. 2015  Type 4 JDBC driver  Compliant with JDBC 4.2 (Java 8.0)  Requires Java 8 or above  Supports MySQL Protocol and X Protocol  Implements the X DevAPI  Compatible with MySQL 5.5 and above Copyright © 2019 Oracle and/or its affiliates. MySQL Connector/J 8.0
  • 11. Copyright © 2019 Oracle and/or its affiliates. Compatible with [Java 8] Java 9+ Supports MySQL 5.5 MySQL 5.6 MySQL 5.7 MySQL 8.0 incl. X Protocol Connector/J 8.0 Compatible with [Java 5] Java 6 Java 7 [Java 8] Java 9+ Supports MySQL 5.1 MySQL 5.5 MySQL 5.6 MySQL 5.7 MySQL 8.0 Connector/J 5.1 Side-by-side [Java n] – Required for compiling
  • 12. Copyright © 2019 Oracle and/or its affiliates. Installing and Using Connector/J
  • 13. Copyright © 2019 Oracle and/or its affiliates.  MySQL Connector/J depends on Google’s protobuf java library for compiling and for running X DevAPI code  Java applications using the X DevAPI via Connector/J 8.0.17 must have at least the following libraries in their Classpath:  mysql-connector-java-8.0.17.jar  protobuf-java-3.6.1.jar  Installations via Linux packages or Windows installer require manual download:  https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.6.1/  Maven enabled projects manage and download all dependencies automatically Library Dependencies
  • 14. Copyright © 2019 Oracle and/or its affiliates.  Download from the official MySQL Downloads page:  https://dev.mysql.com/downloads/connector/j/8.0.html  Portable library bundle  Linux packages and Windows installer  Configure as a maven dependency  https://search.maven.org/artifact/mysql/mysql-connector- java/8.0.17/jar “Installing” MySQL Connector/J Library <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.17</version> </dependency>
  • 15. Copyright © 2019 Oracle and/or its affiliates.  Customized builds and testing Connector/J code  Required tools:  Git client; Apache Ant 1.8.2+; JDK 8+  Required third-party libraries:  Junit 4.12+; Javassist 3.19+; Protcol Buffers Java API 3.6.1; C3P0 0.9.1; JBoss common JDBC wrapper 3.2.3; Simple Logging Facade API 1.6.1  Compile: “Installing” from Source $ git clone --branch release/8.0 https://github.com/mysql/mysql-connector-j.git $ ant -Dcom.mysql.cj.build.jdk=<path_to_jdk_1.8> -Dcom.mysql.cj.extra.libs=<path_to_libraries> dist
  • 16. Connector/J packs loaded with non-standard features that can be enabled or tuned via connection string options. Here are some of them. Copyright © 2019 Oracle and/or its affiliates. Features Showcase
  • 17. Copyright © 2019 Oracle and/or its affiliates. User-defined key:value pairs that get stored into P_S.SESSION_CONNECT_ATTRS JDBC 4.0’s Connection.get/setClientInfo() implementation; appends info data as query comments by default Instead of failing, creates the database identified in the connection string if it doesn’t exist Switch between CATALOG and SCHEMA to define what Connection or MetaData methods and arguments will used when referring to a database connectionAttributes clientInfoProvider createDatabaseIfNotExist databaseTerm General Properties
  • 18. Copyright © 2019 Oracle and/or its affiliates. Monitor and act on connection creation, destruction, commit, rollback and more, potentially altering the execution of these commands Ability to influence queries and Statement objects prior to their execution and modify results afterwards Exceptions thrown by the driver can be intercepted upon their creation giving the user the ability to inject side effects when errors occur connectionLifecycleInterceptors queryInterceptors exceptionInterceptors User-defined Interceptors
  • 19. Copyright © 2019 Oracle and/or its affiliates. List of the classes implementing the interface AuthenticationPlugin for custom or redefined authentication workflow Define what authentication plugin to use as default when the server suggests an unsupported one Authentication plugins not allowed in the connection Should an expired password cause connection close or open in sandbox mode, allowing to reset the pwd What character encoding to use in the password authenticationPlugins defaultAuthenticationPlugin disabledAuthenticationPlugins disconnectOnExpiredPasswords passwordCharacterEncoding On Authentication
  • 20. Copyright © 2019 Oracle and/or its affiliates. Sets the given list of key=value pairs as session variables once the connection is established The character encoding to use when dealing with strings; by default detects the server’s character set The character set should use on results Sets the server character set and collation; overrides characterEncoding sessionVariables characterEncoding characterSetResults connectionCollation Session Specific
  • 21. Copyright © 2019 Oracle and/or its affiliates. The name of the class the that creates client sockets; can be used to change default socket behavior, e.g., use proxies, firewall or replace by Unix Domain Sockets The time the client is willing to wait on socket connect and reads, respectively The maximum size protocol packet can have Enable protocol packets compression Name or IP address of the SOCKS host to connect through and its corresponding port socketFactory connectTimeout/socketTimeout maxAllowedPacket useCompression socksProxyHost/socksProxyPort Network Tweaking
  • 22. Copyright © 2019 Oracle and/or its affiliates. Enables multiple queries in a single statement execution; may return multiple ResultSets; doesn’t affect batched statements Batched statement execution continues even in case of errors Sets the option to kill the connection instead of canceling the query in case of execution timeout Allows disabling escape codes in queries allowMultiQueries continueBatchOnError queryTimeoutKillsConnection enableEscapeProcessing Related to Statements
  • 23. Copyright © 2019 Oracle and/or its affiliates. Switches between server-side prepared statements or client-side emulation of prepared statements Fall-back to client-side prepared statements when preparing server-side prepared statements fails Allows disabling escape codes in queries that are prepared useServerPrepStmts emulateUnsupportedPstmts processEscapeCodesForPrepStmts Related to Prepared Statements
  • 24. Copyright © 2019 Oracle and/or its affiliates. Empty strings are converted to 0 or throw an exception when read as number Allow keeping result sets open after statement close The maximum number of rows to return from the statements running on this connection Pad CHAR type columns with spaces, up to their size emptyStringsConvertToZero holdResultsOpenOverStatementClose maxRows padCharsWithSpace Related to Result Sets
  • 25. Copyright © 2019 Oracle and/or its affiliates. Switch between using INFORMATION_SCHEMA and getting meta data from MYSQL schema and SHOW Indicates if DatabaseMetaData.getProcedures() and similar should return metadata for both stored procedures and functions or just stored procedures When searching metadata, a null value in catalog or schemaPattern means current database or doesn’t apply the filter; see also databaseTerm useInformationSchema getProceduresReturnsFunctions nullDatabaseMeansCurrent Related to Metadata
  • 26. Copyright © 2019 Oracle and/or its affiliates. Set how connections must be secured: DISABLED, PREFERRED, REQUIRED, VERIFY_CA, VERIFY_IDENTITY The list of TLS protocols to allow: TLS_V1 - TLS_V1.2 The list of cipher suites to allow Set of key store details for trust certificates Set of key store details for client certificates Enables getting server’s public key through the wire Enables queries using LOAD DATA LOCAL INFILE sslMode enabledTLSProtocols enabledSSLCipherSuites trustCertificateKeyStore* clientCertificateKeyStore* allowPublicKeyRetrieval allowLoadLocalInfile On Securing Connections
  • 27. Copyright © 2019 Oracle and/or its affiliates. State what time zone the server is in when doing all date time conversions Define what to do when MySQL returns all-zero date time values: EXCEPTION, ROUND or CONVERT_TO_NULL Truncate fractional seconds part when setting date time values Treat the MySQL type YEAR as Date or as short serverTimezone zeroDateTimeBehavior sendFractionalSeconds yearIsDateType Date-time Processing
  • 28. Copyright © 2019 Oracle and/or its affiliates. Keep a session state local reference for auto-commit and transaction isolation values to reduce the number of transaction handling queries to send Cache server variables and collation data from first connection for using in the following connections Either always send or only if different, transaction isolation settings, in Connection.setTransactionIsolation() Either always send or only if different, session auto- commit settings, in Connection.setAutocommit() useLocalSessionState cacheServerConfiguration alwaysSendSetIsolation elideSetAutoCommits Tweaking Performance/1
  • 29. Copyright © 2019 Oracle and/or its affiliates. Sets server-side read-only state or manages it entirely on client-side Cache the parsing stage of client-side prepared statements and server-prepared statements instances Rewrite batched inserts efficiently and/or use multi- queries to reduce the number of queries to send Combined with Statement.setFetchSize() instructs the server to user cursor based server-side prepared statements executions readOnlyPropagatesToServer cachePrepStmts rewriteBatchedStatements useCursorFetch Tweaking Performance/2
  • 30. Copyright © 2019 Oracle and/or its affiliates. Class name that implements a log interface Trace and log queries and their execution time Log queries that take longer than a set threshold Instead of checking the execution time against a threshold, log the ones outside the 99th percentile When slow queries are logged, also include their execution plan Log protocol packets as Hex dumps into the log Logger profileSQL logSlowQueries autoSlowLog explainSlowQueries traceProtocol Debug and Profiling
  • 31. Fail-over, load-balancing, replication-aware, … plenty to choose from to achieve improved high-availability Copyright © 2019 Oracle and/or its affiliates. Multi-host Connections
  • 32.  Support for logic Connection instances backed up by multiple MySQL servers  Underlying physical connections have their own sessions that cannot be tracked, shared or copied  Internal switches between physical connections mean switches between sessions  There are no physical connection switches within a transaction boundary, switches occur only between transactions  Three types of multi-host connections: failover, load-balancing and replication-aware Copyright © 2019 Oracle and/or its affiliates. Multi-host Connections
  • 33.  Connection-related errors trigger fail-over to a secondary host  Connection errors are propagated to the client, that has to handle them  Fall-back to primary host occurs transparent and automatically, based on:  secondsBeforeRetryMaster – the time to wait before falling back  queriesBeforeRetryMaster – number of queries before falling back  With autoReconnect=true the same Statement objects can be reused, otherwise new ones must be created Copyright © 2019 Oracle and/or its affiliates. Fail-over Connections jdbc:mysql://primary:port,secondary1:port,secondary2:port,.../database?props...
  • 34.  Load is distributed among the listed hosts based on customizable load-balancing strategies - ha.loadBalanceStrategy:  Pre-defined: random, bestResponseTime and serverAffinity (pairs with serverAffinityOrder)  Custom made: implementation of com.mysql.cj.jdbc.JdbcConnection.BalanceStrategy  Load balancing/fail-over occurs on:  Transaction boundaries: explicit commit/rollback  Connection exceptions: SQL State “08xxx”  Conditions defined by user:  loadBalanceSQLStateFailover, loadBalanceSQLExceptionSubclassFailover or loadBalanceExceptionChecker  Auto-commit triggers:  loadBalanceAutoCommitStatementThreshold and loadBalanceAutoCommitStatementRegex  Hosts list can be managed through JMX and shared between connections  loadBalanceConnectionGroup & ha.enableJMX  Connection and transaction statistics, add/remove hosts Copyright © 2019 Oracle and/or its affiliates. Load-balancing Connections jdbc:mysql:loadbalance://host1:port,host2:port,host3:port,.../database?props...
  • 35.  Connections are initialized with two sub-connections:  One load-balanced master(s) connection  One load-balanced slaves connection  Connection.setReadOnly() switches between masters and slaves sub-connections  Replication-aware connections specific options:  allowMasterDownConnections – use slaves if no masters or all down, on connection initialization  allowSlavesDownConnections – use masters if no slaves or all down, on connection initialization  readFromMasterWhenNoSlaves – user the masters connection, in read-only, if no slaves or all down  Support for multi-master replication topologies  Hosts list can be managed through JMX and shared between connections  replicationConnectionGroup & ha.enableJMX  Connection and transaction statistics, add/remove hosts, promoting/demoting hosts, etc. Copyright © 2019 Oracle and/or its affiliates. Replication-aware Connections jdbc:mysql:replication://master:port,slave1:port,slave2:port,.../database?props...
  • 36. Copyright © 2019 Oracle and/or its affiliates. From Connector/J 5.1 to 8.0 With progress comes change, with change comes sacrifice. Not all decisions were easily made, but we believe we did them for our users benefit.
  • 37. From minimum JVM version 8 to new temporal data handling defaults, sometimes upgrading is not just a drop- in replacement. Copyright © 2019 Oracle and/or its affiliates. What changed?
  • 38. Copyright © 2019 Oracle and/or its affiliates.  Runs on Java 8; users are advised to check the Java incompatibility information, provided by Oracle, before upgrading  Improved connection strings syntax  Several connection properties were removed, a few renamed and some added  Major code refactoring and overhaul for improved performance  Packages structure changed entirely, some classes were deprecated  Exceptions updated to match JDBC standard  Default temporal data types changed regarding time zones handling  Ant build and testing procedures were restructured Overall Changes
  • 39. Copyright © 2019 Oracle and/or its affiliates.  New scheme – mysqlx: – for X DevAPI sessions  Authority section of connection strings (user and hosts information) supports multiple syntaxes:  The {host} part can be written as:  IPv6 addresses must be written between square brackets: [::1] Improved Connection Strings scheme://[usr[:pwd]@]{host},[usr[:pwd]@][{host},{host},...],.../db?key=value&... hostOrIP:portNumber address=(host=hostOrIP)(port=portNumber)(key=value)(...) (host=hostOrIP,port=portNumber,key=value,...) (address=hostOrIP:portNumber,key=value,...)
  • 40. Copyright © 2019 Oracle and/or its affiliates.  Legacy Date and Time handling:  dynamicCalendars, noTzConversionForTimeType, noTzConversionForDateType, cacheDefaultTimezone, useFastIntParsing, useFastDateParsing, useJDBCCompliantTimezoneShift, useLegacyDatetimeCode, useSSPSCompatibleTimezoneShift, useTimezone, useGmtMillisForDatetimes  Connection properties removed:  useBlobToStoreUTF8OutsideBMP, utf8OutsideBmpExcludedColumnNamePattern, and utf8OutsideBmpIncludedColumnNamePattern – utf8mb4 is now supported in all maintained MySQL versions Changes in Connection Properties/1
  • 41. Copyright © 2019 Oracle and/or its affiliates.  Connection properties removed:  useDynamicCharsetInfo – no more cached custom charset mappings  useJvmCharsetConverters – JVM charsets now used in all cases  dumpMetadataOnColumnNotFound – redundant feature  relaxAutoCommit – for MySQL versions with no transactions support  strictFloatingPoint – was used on deprecated test suite  runningCTS13 – was used on deprecated test suite  retainStatementAfterResultSetClose – not JDBC compliant  nullNamePatternMatchesAll – not JDBC compliant Changes in Connection Properties/2
  • 42. Copyright © 2019 Oracle and/or its affiliates.  Main package is now com.mysql.cj.jdbc  Entry class Driver moved from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver; old one was deprecated  Commonly used interfaces that moved: Changes in the Connector/J API/1 com.mysql.jdbc.ExceptionInterceptor com.mysql.cj.exceptions.ExceptionInterceptor com.mysql.jdbc.StatementInterceptorV2 com.mysql.cj.interceptors.QueryInterceptor com.mysql.jdbc. ConnectionLifecycleInterceptor com.mysql.cj.jdbc.interceptors. ConnectionLifecycleInterceptor
  • 43. Copyright © 2019 Oracle and/or its affiliates.  Commonly used interfaces that moved (continuation): Changes in the Connector/J API/2 com.mysql.jdbc.AuthenticationPlugin com.mysql.cj.protocol.AuthenticationPlugin com.mysql.jdbc.jdbc2.optional. MysqlDataSource com.mysql.cj.jdbc.MysqlDataSource com.mysql.jdbc.jdbc2.optional. MysqlDataSourceFactory com.mysql.cj.jdbc.MysqlDataSourceFactory com.mysql.jdbc.jdbc2.optional. MysqlConnectionPoolDataSource com.mysql.cj.jdbc. MysqlConnectionPoolDataSource com.mysql.jdbc.jdbc2.optional. MysqlXADataSource com.mysql.cj.jdbc.MysqlXADataSource com.mysql.jdbc.jdbc2.optional.MysqlXid com.mysql.cj.jdbc.MysqlXid Not only changes in package names but also on methods signatures
  • 44. Copyright © 2019 Oracle and/or its affiliates.  Most exceptions were duplicated before:  Pre-JDBC 4 versions in package com.mysql.jdbc.exceptions  Post-JDBC 4 versions in package com.mysql.jdbc.exceptions.jdbc4  Due to multi-JVM and multi-JDBC support in Connector/J  Duplicated exceptions are now merged in one  All Connector/J exceptions extend or were replaced by the corresponding standard JDBC exceptions Changes in Exceptions/1
  • 45. Copyright © 2019 Oracle and/or its affiliates. com.mysql.jdbc.exceptions.jdbc4. CommunicationsException com.mysql.cj.jdbc.exceptions. CommunicationsException com.mysql.jdbc.exceptions.[jdbc4.] MySQLDataException java.sql.SQLDataException com.mysql.jdbc.exceptions.[jdbc4.] MySQLIntegrityConstraintViolationException java.sql. SQLIntegrityConstraintViolationException com.mysql.jdbc.exceptions.[jdbc4.] MySQLInvalidAuthorizationSpecException java.sql.SQLInvalidAuthorizationSpecException com.mysql.jdbc.exceptions.[jdbc4.] MySQLNonTransientConnectionException java.sql.SQLNonTransientConnectionException com.mysql.jdbc.exceptions.[jdbc4.] MySQLNonTransientException java.sql.SQLNonTransientException com.mysql.jdbc.exceptions.[jdbc4.] MySQLQueryInterruptedException com.mysql.cj.jdbc.exceptions. MySQLQueryInterruptedException Changes in Exceptions/2
  • 46. Copyright © 2019 Oracle and/or its affiliates. com.mysql.jdbc.exceptions. MySQLStatementCancelledException com.mysql.cj.jdbc.exceptions. MySQLStatementCancelledException com.mysql.jdbc.exceptions.[jdbc4.] MySQLSyntaxErrorException java.sql.SQLSyntaxErrorException com.mysql.jdbc.exceptions.[jdbc4.] MySQLTimeoutException java.sql.SQLTimeoutException com.mysql.jdbc.exceptions.[jdbc4.] MySQLTransactionRollbackException java.sql.SQLTransactionRollbackException com.mysql.jdbc.exceptions.[jdbc4.] MySQLTransientConnectionException java.sql.SQLTransientConnectionException com.mysql.jdbc.exceptions.[jdbc4.] MySQLTransientException java.sql.SQLTransientException m.mysql.jdbc.exceptions.[jdbc4.] MySQLIntegrityConstraintViolationException java.sql. SQLIntegrityConstraintViolationException Changes in Exceptions/3
  • 47. For a long time the lack of support for time-zone information in date-time values has been causing problems for many. It isn’t fixed yet, but we hope we are a step closer. Copyright © 2019 Oracle and/or its affiliates. The Time Zones Conundrum
  • 48. Use Case Clients in different time zones store and read a DATETIME value that doesn’t carry TZ information Client 1 TZ: UTC-7 Client 2 TZ: UTC+1 Client 3 TZ: UTC-4 Backend Systems Application Server TZ: irrelevant Data Store TZ: UTC-4 MySQL TZ: System Copyright © 2019 Oracle and/or its affiliates. 2019-09-19 11:50:002019-09-19 11:50:00 2019-09-19 14:50:002019-09-19 14:50:00 2019-09-19 19:50:00 2019-09-19 14:50:002019-09-19 14:50:00
  • 49.  MySQL doesn’t support time zone info in date-time values  By default Connector/J discovers the server time zone:  By default MySQL server refers to system time zone, that mostly uses abbreviations  Time zone abbreviations aren’t deterministic  “The server time zone value 'PDT' is unrecognized or represents more than one time zone.”  Client has to set what is the target and source time zone when storing and retrieving temporal data, respectively  Time zones that observe DST have time gaps and overlaps Copyright © 2019 Oracle and/or its affiliates. So, what’s the problem?
  • 50.  All temporal data in PreparedStatment getters and setters are subject to time zone adjustments  Client application has to choose: 1. Adjust to server time zone when stored and adjust back to the client time zone when loaded  default or serverTimezone=<server_TZ> 2. Store and read as-is, i.e., no time zone adjustment  serverTimezone=<client_TZ> 3. Adjust to/from a neutral time zone  serverTimezone=UTC  Recommendation is to set neutral TZ, w/o DST, adjustments Copyright © 2019 Oracle and/or its affiliates. Date-time Handling Policies in Connector/J 8.0
  • 51. Are you ready new database programming API? Give it a try and experiment the MySQL X DevAPI. Copyright © 2019 Oracle and/or its affiliates. X DevAPI Sneak Peek
  • 52. Copyright © 2019 Oracle and/or its affiliates.  Synchronous and Asynchronous operation executions  Secure by default (TLS+SHA2)  Transactions, save points and row-locking  Auto-magic prepared statements  Connection pooling and fail- over  Integrated in the MySQL Shell  Enables MySQL Document Store to client applications  Offers schema-less data storage development  Fluent API  Programming language agnostic  Intuitive CRUD methods  Raw SQL also available  Domain specific expression language X DevAPI Key Features
  • 53. Copyright © 2019 Oracle and/or its affiliates. X DevAPI CRUD X DevAPI SQL JDBCX DevAPI Sneak Peek Side by Side: JDBC/1 Connection conn = DriverManager .getConnection("jdbc:mysql://localhost/alcatraz", "demousr", "demopwd"); Statement stmt = conn.createStatement(); stmt.execute("CREATE TABLE facilities (id INT AUTO_INCREMENT PRIMARY KEY, " + "designation VARCHAR(100), capacity INT)"); PreparedStatement pstmt = conn .prepareStatement("INSERT INTO facilities VALUES (NULL, ?, ?)"); pstmt.setString(1, "B-206"); pstmt.setInt(2, 1); pstmt.execute(); pstmt.setString(1, "Mess Hall"); pstmt.setInt(2, 250); pstmt.execute(); pstmt.close();
  • 54. Copyright © 2019 Oracle and/or its affiliates. X DevAPI CRUD X DevAPI SQL JDBCX DevAPI Sneak Peek Side by Side: JDBC/2 rs = stmt.executeQuery("SELECT * FROM facilities"); while (rs.next()) { System.out.printf("%d: %s (%d)%n", rs.getInt(1), rs.getString(2), rs.getInt(3)); } | 1: B-206 (1) | 2: Mess Hall (250) stmt.execute("DROP TABLE facilities"); stmt.close(); conn.close();
  • 55. Copyright © 2019 Oracle and/or its affiliates. X DevAPI CRUD X DevAPI SQL JDBCX DevAPI Sneak Peek Side by Side: X DevAPI Raw SQL/1 SessionFactory sf = new SessionFactory(); Session sess = sf.getSession("mysqlx://demousr:demopwd@localhost:33060/alcatraz"); sess.sql("CREATE TABLE facilities (id INT AUTO_INCREMENT PRIMARY KEY, " + "designation VARCHAR(100), capacity INT)").execute(); SqlStatement stmt = sess.sql("INSERT INTO facilities VALUES (NULL, ?, ?)"); stmt.bind(Arrays.asList("B-206", 1)).execute(); stmt.clearBindings().bind(Arrays.asList("Mess Hall", 250)).execute();
  • 56. Copyright © 2019 Oracle and/or its affiliates. X DevAPI CRUD X DevAPI SQL JDBCX DevAPI Sneak Peek Side by Side: X DevAPI Raw SQL/2 sess.sql("SELECT * FROM facilities").execute().forEach(r -> System .out.printf("%d: %s (%d)%n", r.getInt(0), r.getString(1), r.getInt(2))); | 1: B-206 (1) | 2: Mess Hall (250) sess.sql("DROP TABLE facilities").execute(); sess.close();
  • 57. Copyright © 2019 Oracle and/or its affiliates. X DevAPI CRUD X DevAPI SQL JDBCX DevAPI Sneak Peek Side by Side: X DevAPI CRUD/1 SessionFactory sf = new SessionFactory(); Session sess = sf.getSession("mysqlx://demousr:demopwd@localhost:33060/alcatraz"); sess.sql("CREATE TABLE facilities (id INT AUTO_INCREMENT PRIMARY KEY, " + "designation VARCHAR(100), capacity INT)").execute(); Table tbl = schm.getTable("facilities"); tbl.insert("designation", "capacity").values("B-206", 1).values("Mess Hall", 250) .execute();
  • 58. Copyright © 2019 Oracle and/or its affiliates. X DevAPI CRUD X DevAPI SQL JDBCX DevAPI Sneak Peek Side by Side: X DevAPI CRUD/2 tbl.select().execute().forEach(r -> System .out.printf("%d: %s (%d)%n", r.getInt(0), r.getString(1), r.getInt(2))); | 1: B-206 (1) | 2: Mess Hall (250) sess.sql("DROP TABLE facilities").execute(); sess.close();
  • 59. Let’s wrap this up… Copyright © 2019 Oracle and/or its affiliates. Closing Comments, Q & A
  • 60.  Use MySQL Connector/J 8.0, MySQL Connector/J 5.1 may be EOLed at any time  Extensive connection options set; consult the documentation  Built-in support for multi-host connections  MySQL Connector/J 8.0:  Is GA and the recommend version to use  Runs on Java 8 and above  Complete refactoring and overhaul  More consistency in vendor custom APIs  JDBC for MySQL and MySQL Document Store support in same driver  X DevAPI out-of-the-box Copyright © 2019 Oracle and/or its affiliates. Closing Comments
  • 61. Q & A https://dev.mysql.com Copyright © 2019 Oracle and/or its affiliates.
  • 62. The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Copyright © 2019 Oracle and/or its affiliates.
  • 63. Session Survey Help us make the content even better. Please complete the session survey in the Mobile App. Copyright © 2019 Oracle and/or its affiliates.
  • 64. Thank You Copyright © 2019 Oracle and/or its affiliates. Connector/J Developer and Team Lead MySQL Middleware and Clients September 17, 2019 Filipe Silva