SlideShare a Scribd company logo
1 of 41
Without
the SQL
OH My!
Safe
Harbor
Agreement
2
"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, AND TIMING OF
ANY FEATURES OR FUNCTIONALITY
DESCRIBED FOR ORACLE'S PRODUCTS
REMAINS AT THE SOLE DISCRETION OF
ORACLE."
Dave Stokes
MySQL
Community
Manager
@stoker
david.stokes@oracle.com
slideshare.net/davidmstokes
3
MySQL
22 years old
Oracle owned
8 years
Hiring!
(work from
home!!)
MySQL 5.7 – October 2015
▪ JSON Data type
▪ Secure by Default
▪ Password Expiration
▪ At rest encryption
▪ Ngram, MeCAB & GB18030
▪ Improved GIS
▪ Dynamic InnoDB buffer pool size
▪ Stacked triggers
▪ Generated columns
▪ Parallel replication
Plug Ins
▪ Group Replication
▪ Document Store
MySQL 8 – Soon
▪ Data Dictionary
▪ Atomic DDL
▪ No more Bug #199
▪ Roles
▪ JSON Enhanced
▪ Resource Groups
▪ UTF8MB4
▪ Invisible Indexes
▪ True Descending Indexes
▪ CTWs & Windowing Functions
▪ Histograms
▪ CATS
4
5
MySQL
Without
the SQL!
Developers
and DBAs
see data
differently
6
mysql-js> db.countryinfo.find("_id='USA'")
[
{
"GNP": 8510700,
"IndepYear": 1776,
"Name": "United States",
"_id": "USA",
"demographics": {
"LifeExpectancy": 77.1,
"Population": 278357000
},
"geography": {
"Continent": "North America",
"Region": "North America",
"SurfaceArea": 9363520
},
"government": {
"GovernmentForm": "Federal Republic",
"HeadOfState": "George W. Bush"
}
}
]
1 document in set (0.01 sec)
mysql-js>
Developers Developers have a much more complex job compared to a
decade ago
7
▪ Start coding first, design later (ready, fire, aim!)
▪ Scope Creep, Mission Creep
▪ New flashy tech pushed down from Management
▪ New flashy tech pushed to keep resume current
▪ Legacy code
▪ Learning curve (ever steepening)
▪ Continuous fire fighting
DBAs
(& Devops)
DBAs have a much more complex job compared to a decade
ago
8
▪ Keep data safe
▪ Stability
▪ CI
▪ Flexibility
▪ Regulations & policies for data retention
▪ Maximize uptime (no window for maintenance)
▪ Ripple changes that never end
▪ More demands , less $$$
▪ Relational model fits so many business needs
Structed Query
Language
1. Descriptive Language
2. DML and DDL
3. Requires:
a. Knowledge of sets
b. Knowledge of the data
4. Hard to tell if a query is
good just by looking at it
1. No ‘gut feeling’ about query
2. EXPLAIN
9
SQL was designed in the 1970s to
minimize data duplication (disks were
very expensive) and allows the access
of many records in one command
without have to specify how to get to
it.
10
Roughly 2% of
developers have
formal training in
SQL, Relational
Theory, or sets(my survey)
And 100%
of the rest
wonder
why their
queries
stink!
ORMs
Developers might
use a Object
Relation Mapper
to map between
RDMS and
objects in code.
Extra layer of
confusion.
Extra inclination
on learning
curve.
11
How do you
provide for both sets
of needs?
12
What if there was a
way to provide both
SQL and NoSQL
on one stable
platform that has
proven stability on
well known
technology?
The
MySQL
Document
Store
SQL
is now
optional!
13
Built on the
MySQL
JSON Data
type
and
Proven
MySQL
Server
Technology
 Provides a schema flexible JSON document store
 No SQL required
 No need to define all possible attributes, tables, etc.
 Uses new X DevAPI
 MySQL 5.7 & 8
 Can leverage generated columns to extract JSON values into
materialized columns that can be indexed for fast SQL searches.
 Documents can be ~1GB
 It is a column in a row of a table
 Allows use of modern programming styles
 No more embedded strings of SQL in your code
 Easy to read
 Also works with relational tables
 Proven MySQL Technology
14
X DevAPI • Connectors for
• C++, Java, .Net, Node.JS, Python, JavaScript,
PHP
• More on the way
• New MySQL Shell
• Command Completion
• Python, JavaScript & SQL modes
• Admin functions
• A new high-level session concept that can scale
from single MySQL Server to a multiple server
environment.
• Non-blocking, asynchronous calls follow common
language patterns
• Modern practices and syntax styles are used to get away
from traditional SQL-String-Building
15
MySQL
Document
Store
Installation
mysqlsh -u user -h localhost --classic --dba enableXProtocol
OR
$mysql –u root –p
mysql> INSTALL PLUGIN mysqlx SONAME 'mysqlx.so‘ ; *
16* .dll for windows instead of .so
mysqlsh
17
▪ New command line
client built on X
DevAPI (old client is
not going away
anytime soon).
▪ Visually appealing
▪ Command
Completion
▪ Three modes
- Python
- JavaScript
- SQL
Login with
MySQL
Shell
18
MySQL Shell 8.0.5
Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help' or '?' for help; 'quit' to exit.
MySQL JS> connect root@localhost/world_x
Creating a session to 'root@localhost/world_x'
Enter password: ******
Your MySQL connection id is 4 (X protocol)
Server version: 5.7.21-log MySQL Community Server (GPL)
Default schema `world_x` accessible through db.
Fetching schema names for auto-completion... Press ^C to stop.
MySQL [localhost+/world_x] JS>
Status
19
The db
variable is
assigned to
the active
schema.
Document
collections
are in the
schemas.
20
21
Specify Fields
22
Limit
23
EBNF for Find()
https://dev.mysql.com/doc/x-devapi-userguide/en/crud-ebnf-collection-crud-functions.html
24
EBNF for Modify()
https://dev.mysql.com/doc/x-devapi-userguide/en/crud-ebnf-collection-crud-functions.html
25
EBNF for Add()
https://dev.mysql.com/doc/x-devapi-userguide/en/crud-ebnf-collection-crud-functions.html
26
EBNF for Remove()
https://dev.mysql.com/doc/x-devapi-userguide/en/crud-ebnf-collection-crud-functions.html
Python
import mysqlx
# Connect to server on localhost
session = mysqlx.get_session({
'host': 'localhost',
'port': 33060,
'user': 'dave',
'password': 'S3cR3T!',
'ssl-mode' : mysqlx.SSLMode.DISABLED #Remove this line if SSL enabled
})
schema = session.get_schema('world_x')
# Use the collection 'countryinfo'
collection = schema.get_collection('countryinfo')
# Specify which document to find with Collection.find()
result = collection.find('_id like :param').bind('param',
'USA').execute()
# Print document
docs = result.fetch_all()
print('id: {0}'.format(docs[0]['Name']))
27
Node.JS
// Simple example to grab one record and print it
const mysqlx = require('@mysql/xdevapi');
const options = {
host: 'localhost', port: 33060, dbUser: 'dave', dbPassword:
'S3cR3t!!'
};
mysqlx
.getSession(options)
.then (session => {
var schema = session.getSchema('world_x');
//equivalent of SELECT doc FROM countryinfo where _id = 'USA'
var coll = schema.getCollection('countryinfo');
var query = "$._id == 'USA'";
// Print doc
return Promise.all([
coll.find(query).execute(function (doc) {
console.log(doc);
}),
session.close()
]);
})
.catch(err => {
console.log(err.message);
console.log(err.stack);
});
28
PHP
#!/usr/bin/php
<?PHP
// Connection parameters
$user = 'dave';
$passwd = 'S3cR3t!';
$host = 'localhost';
$port = '33060';
$connection_uri = 'mysqlx://'.$user.':'.$passwd.'@'.
$host.':'.$port;
echo $connection_uri . "n";
// Connect as a Node Session
$nodeSession =
mysql_xdevapigetNodeSession($connection_uri);
// "USE world_x"
$schema = $nodeSession->getSchema("world_x");
// Specify collection to use
$collection = $schema->getCollection("countryinfo");
// Query the Document Store
$result = $collection->find('_id = "USA"')->fields(['Name
as Country','geography as Geo','geography.Region'])-
>execute();
// Fetch/Display data
$data = $result->fetchAll();
var_dump($data);
?>
29
How Does it Work?Very well, thank you!
30
What does a
collection
look like on
the server?
mysql> DESC countryinfo;
+-------+-------------+------+-----+---------+------------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+------------------+
| doc | json | YES | | NULL | |
| _id | varchar(32) | NO | PRI | NULL | STORED GENERATED |
+-------+-------------+------+-----+---------+------------------+
2 rows in set (0.02 sec)
mysql> show create table countryinfoG
*************************** 1. row ***************************
Table: countryinfo
Create Table: CREATE TABLE `countryinfo` (
`doc` json DEFAULT NULL,
`_id` varchar(32) GENERATED ALWAYS AS
(json_unquote(json_extract(`doc`,'$._id))) STORED NOT
NULL,
PRIMARY KEY (`_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
31
Every document has a unique identifier called the document
ID, which can be thought of as the equivalent of a tables'
primary key. The document ID value can be manually
assigned when adding a document. If no value is assigned, a
document ID is generated and assigned to the document
automatically!
Use getDocumentId() or getDocumentIds() to get _id(s)
32
_id
You can also
use the
JavaScript or
Python
modes to
process code
// Connecting to MySQL and working with a Session
var mysqlx = require('mysqlx');
// Connect to a dedicated MySQL server using a connection URL
var mySession = mysqlx.getSession(‘acct:spE!@localhost');
// Get a list of all available schemas
var schemaList = mySession.getSchemas();
print('Available schemas in this session:n');
// Loop over all available schemas and print their name
for (index in schemaList) {
print(schemaList[index].name + 'n');
}
mySession.close();
33
But what about
my existing
relational tables??
34
Yes, the
MySQL
Document
Store can
work with
relational
tables too!
# Working with Relational Tables
import mysqlx
# Connect to server using a connection URL
mySession = mysqlx.get_session( {
'host': 'localhost', 'port': 33060,
'dbUser': ‘joe', 'dbPassword': ‘ZipL1p!'} )
myDb = mySession.get_schema('test')
# Accessing an existing table
myTable = myDb.get_table('my_table')
# Insert SQL Table data
myTable.insert(['name','birthday','age']) 
.values('Sakila', mysqlx.date_value(2000, 5, 27), 16).execute()
# Find a row in the SQL Table
myResult = myTable.select(['_id', 'name', 'birthday']) 
.where('name like :name AND age < :age') 
.bind('name', 'S%') 
.bind('age', 20).execute()
# Print result
print myResult.fetch_all()
35
But what about relational tables and
collections together? Eh, Dave?
Huh, huh, huh?
36
But what about relational tables and
collections together? Eh, Dave?
Huh, huh, huh?
37
// Get the customers collection as a table
var customers = db.getCollectionAsTable('customers');
customers.insert('doc').values('{"_id":"001", "name": "mike"}').execute();
38
You can cast a collection as a table
import com.mysql.cj.api.xdevapi.*;
import com.mysql.cj.xdevapi.*;
// Connect to server
Session mySession = new SessionFactory().getSession("mysqlx://10.10.10.192:33060/test?user=betty12;password=Hush!");
Schema db = mySession.getSchema("test");
// Create a new collection
Collection myColl = db.createCollection("my_collection");
// Start a transaction
this.session.startTransaction();
try {
myColl.add("{"name":"Jack", "age":15}", "{"name":"Susanne", "age":24}",
"{"name":"Mike", "age":39}");
this.session.commit();
System.out.println("Data inserted successfully.");
} catch (Exception err) {
// Rollback the transaction in case of an error
this.session.rollback();
// Printing the error message
System.out.println("Data could not be inserted: " + err.getMessage());
}
39
Transactions!
MySQL
Document Store
Available Now
40
▪ Plug-in for
- MySQL 5.7
- MySQL 8
▪ Best of both SQL &
NoSQL worlds
▪ Proven MySQL
Technology
Hello!
Nice to meet you
41
Contact info:
▪ www.mysql.com
▪ David.Stokes@Oracle.com
▪ @Stoker
▪ Slides:slideshare.net/davidmstokes
▪ Blog: Elephantdolphin.blogspot.com
▪ Book in preperation now

More Related Content

What's hot

Create manula and automaticly database
Create manula and automaticly databaseCreate manula and automaticly database
Create manula and automaticly database
Anar Godjaev
 
Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014
Özgür Umut Vurgun
 

What's hot (20)

Discover the Power of the NoSQL + SQL with MySQL
Discover the Power of the NoSQL + SQL with MySQLDiscover the Power of the NoSQL + SQL with MySQL
Discover the Power of the NoSQL + SQL with MySQL
 
Use Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB GuruUse Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB Guru
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!
 
Create manula and automaticly database
Create manula and automaticly databaseCreate manula and automaticly database
Create manula and automaticly database
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentation
 
Curso de MySQL 5.7
Curso de MySQL 5.7Curso de MySQL 5.7
Curso de MySQL 5.7
 
2012 summarytables
2012 summarytables2012 summarytables
2012 summarytables
 
Best Features of Multitenant 12c
Best Features of Multitenant 12cBest Features of Multitenant 12c
Best Features of Multitenant 12c
 
Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014
 
Tech Talk: Best Practices for Data Modeling
Tech Talk: Best Practices for Data ModelingTech Talk: Best Practices for Data Modeling
Tech Talk: Best Practices for Data Modeling
 
TechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - Trivadis
TechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - TrivadisTechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - Trivadis
TechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - Trivadis
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational Changes
 
Security Best Practice: Oracle passwords, but secure!
Security Best Practice: Oracle passwords, but secure!Security Best Practice: Oracle passwords, but secure!
Security Best Practice: Oracle passwords, but secure!
 
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
 
Database 12c is ready for you... Are you ready for 12c?
Database 12c is ready for you... Are you ready for 12c?Database 12c is ready for you... Are you ready for 12c?
Database 12c is ready for you... Are you ready for 12c?
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentation
 
Couchbase Overview - Monterey Bay Information Technologists Meetup 02.15.17
Couchbase Overview - Monterey Bay Information Technologists Meetup 02.15.17Couchbase Overview - Monterey Bay Information Technologists Meetup 02.15.17
Couchbase Overview - Monterey Bay Information Technologists Meetup 02.15.17
 
20201106 hk-py con-mysql-shell
20201106 hk-py con-mysql-shell20201106 hk-py con-mysql-shell
20201106 hk-py con-mysql-shell
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven Features
 
MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015
 

Similar to MySQL Without the MySQL -- Oh My!

android sqlite
android sqliteandroid sqlite
android sqlite
Deepa Rani
 

Similar to MySQL Without the MySQL -- Oh My! (20)

Making MySQL Agile-ish
Making MySQL Agile-ishMaking MySQL Agile-ish
Making MySQL Agile-ish
 
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
 
MySQL Without the SQL -- Oh My!
MySQL Without the SQL -- Oh My!MySQL Without the SQL -- Oh My!
MySQL Without the SQL -- Oh My!
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
 
Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016
 
Discover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQLDiscover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQL
 
MySQL as a Document Store
MySQL as a Document StoreMySQL as a Document Store
MySQL as a Document Store
 
MySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x PresentationMySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x Presentation
 
MySQL Without the SQL - Oh My! -> MySQL Document Store -- Confoo.CA 2019
MySQL Without the SQL - Oh My! -> MySQL Document Store -- Confoo.CA 2019MySQL Without the SQL - Oh My! -> MySQL Document Store -- Confoo.CA 2019
MySQL Without the SQL - Oh My! -> MySQL Document Store -- Confoo.CA 2019
 
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
 
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...
PHP,  The X DevAPI,  and the  MySQL Document Store Presented January 23rd, 20...PHP,  The X DevAPI,  and the  MySQL Document Store Presented January 23rd, 20...
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...
 
Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019
 
All Things Open 2016 -- Database Programming for Newbies
All Things Open 2016 -- Database Programming for NewbiesAll Things Open 2016 -- Database Programming for Newbies
All Things Open 2016 -- Database Programming for Newbies
 
MySQL Document Store
MySQL Document StoreMySQL Document Store
MySQL Document Store
 
MySQL 8.0 from December London Open Source Database Meetup
MySQL 8.0 from December London Open Source Database MeetupMySQL 8.0 from December London Open Source Database Meetup
MySQL 8.0 from December London Open Source Database Meetup
 
android sqlite
android sqliteandroid sqlite
android sqlite
 
My sql 5.6&MySQL Cluster 7.3
My sql 5.6&MySQL Cluster 7.3My sql 5.6&MySQL Cluster 7.3
My sql 5.6&MySQL Cluster 7.3
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...
 
A MySQL Odyssey - A Blackhole Crossover
A MySQL Odyssey - A Blackhole CrossoverA MySQL Odyssey - A Blackhole Crossover
A MySQL Odyssey - A Blackhole Crossover
 
Couchbase Data Platform | Big Data Demystified
Couchbase Data Platform | Big Data DemystifiedCouchbase Data Platform | Big Data Demystified
Couchbase Data Platform | Big Data Demystified
 

More from Dave Stokes

More from Dave Stokes (15)

Database basics for new-ish developers -- All Things Open October 18th 2021
Database basics for new-ish developers  -- All Things Open October 18th 2021Database basics for new-ish developers  -- All Things Open October 18th 2021
Database basics for new-ish developers -- All Things Open October 18th 2021
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
 
Midwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesMidwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL Features
 
Data Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database AnalyticsData Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database Analytics
 
Confoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesConfoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New Features
 
Confoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsConfoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & Histograms
 
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
 
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
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
 
MySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 PresentationMySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 Presentation
 
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
 
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
 
Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019
 
Oracle CodeOne Foreign Keys Support in MySQL 8.0
Oracle CodeOne Foreign Keys Support in MySQL 8.0Oracle CodeOne Foreign Keys Support in MySQL 8.0
Oracle CodeOne Foreign Keys Support in MySQL 8.0
 

Recently uploaded

6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
Diya Sharma
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
sexy call girls service in goa
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
ellan12
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 

MySQL Without the MySQL -- Oh My!

  • 2. Safe Harbor Agreement 2 "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, AND TIMING OF ANY FEATURES OR FUNCTIONALITY DESCRIBED FOR ORACLE'S PRODUCTS REMAINS AT THE SOLE DISCRETION OF ORACLE."
  • 4. MySQL 22 years old Oracle owned 8 years Hiring! (work from home!!) MySQL 5.7 – October 2015 ▪ JSON Data type ▪ Secure by Default ▪ Password Expiration ▪ At rest encryption ▪ Ngram, MeCAB & GB18030 ▪ Improved GIS ▪ Dynamic InnoDB buffer pool size ▪ Stacked triggers ▪ Generated columns ▪ Parallel replication Plug Ins ▪ Group Replication ▪ Document Store MySQL 8 – Soon ▪ Data Dictionary ▪ Atomic DDL ▪ No more Bug #199 ▪ Roles ▪ JSON Enhanced ▪ Resource Groups ▪ UTF8MB4 ▪ Invisible Indexes ▪ True Descending Indexes ▪ CTWs & Windowing Functions ▪ Histograms ▪ CATS 4
  • 6. Developers and DBAs see data differently 6 mysql-js> db.countryinfo.find("_id='USA'") [ { "GNP": 8510700, "IndepYear": 1776, "Name": "United States", "_id": "USA", "demographics": { "LifeExpectancy": 77.1, "Population": 278357000 }, "geography": { "Continent": "North America", "Region": "North America", "SurfaceArea": 9363520 }, "government": { "GovernmentForm": "Federal Republic", "HeadOfState": "George W. Bush" } } ] 1 document in set (0.01 sec) mysql-js>
  • 7. Developers Developers have a much more complex job compared to a decade ago 7 ▪ Start coding first, design later (ready, fire, aim!) ▪ Scope Creep, Mission Creep ▪ New flashy tech pushed down from Management ▪ New flashy tech pushed to keep resume current ▪ Legacy code ▪ Learning curve (ever steepening) ▪ Continuous fire fighting
  • 8. DBAs (& Devops) DBAs have a much more complex job compared to a decade ago 8 ▪ Keep data safe ▪ Stability ▪ CI ▪ Flexibility ▪ Regulations & policies for data retention ▪ Maximize uptime (no window for maintenance) ▪ Ripple changes that never end ▪ More demands , less $$$ ▪ Relational model fits so many business needs
  • 9. Structed Query Language 1. Descriptive Language 2. DML and DDL 3. Requires: a. Knowledge of sets b. Knowledge of the data 4. Hard to tell if a query is good just by looking at it 1. No ‘gut feeling’ about query 2. EXPLAIN 9 SQL was designed in the 1970s to minimize data duplication (disks were very expensive) and allows the access of many records in one command without have to specify how to get to it.
  • 10. 10 Roughly 2% of developers have formal training in SQL, Relational Theory, or sets(my survey) And 100% of the rest wonder why their queries stink!
  • 11. ORMs Developers might use a Object Relation Mapper to map between RDMS and objects in code. Extra layer of confusion. Extra inclination on learning curve. 11
  • 12. How do you provide for both sets of needs? 12 What if there was a way to provide both SQL and NoSQL on one stable platform that has proven stability on well known technology?
  • 14. Built on the MySQL JSON Data type and Proven MySQL Server Technology  Provides a schema flexible JSON document store  No SQL required  No need to define all possible attributes, tables, etc.  Uses new X DevAPI  MySQL 5.7 & 8  Can leverage generated columns to extract JSON values into materialized columns that can be indexed for fast SQL searches.  Documents can be ~1GB  It is a column in a row of a table  Allows use of modern programming styles  No more embedded strings of SQL in your code  Easy to read  Also works with relational tables  Proven MySQL Technology 14
  • 15. X DevAPI • Connectors for • C++, Java, .Net, Node.JS, Python, JavaScript, PHP • More on the way • New MySQL Shell • Command Completion • Python, JavaScript & SQL modes • Admin functions • A new high-level session concept that can scale from single MySQL Server to a multiple server environment. • Non-blocking, asynchronous calls follow common language patterns • Modern practices and syntax styles are used to get away from traditional SQL-String-Building 15
  • 16. MySQL Document Store Installation mysqlsh -u user -h localhost --classic --dba enableXProtocol OR $mysql –u root –p mysql> INSTALL PLUGIN mysqlx SONAME 'mysqlx.so‘ ; * 16* .dll for windows instead of .so
  • 17. mysqlsh 17 ▪ New command line client built on X DevAPI (old client is not going away anytime soon). ▪ Visually appealing ▪ Command Completion ▪ Three modes - Python - JavaScript - SQL
  • 18. Login with MySQL Shell 18 MySQL Shell 8.0.5 Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help' or '?' for help; 'quit' to exit. MySQL JS> connect root@localhost/world_x Creating a session to 'root@localhost/world_x' Enter password: ****** Your MySQL connection id is 4 (X protocol) Server version: 5.7.21-log MySQL Community Server (GPL) Default schema `world_x` accessible through db. Fetching schema names for auto-completion... Press ^C to stop. MySQL [localhost+/world_x] JS>
  • 20. The db variable is assigned to the active schema. Document collections are in the schemas. 20
  • 27. Python import mysqlx # Connect to server on localhost session = mysqlx.get_session({ 'host': 'localhost', 'port': 33060, 'user': 'dave', 'password': 'S3cR3T!', 'ssl-mode' : mysqlx.SSLMode.DISABLED #Remove this line if SSL enabled }) schema = session.get_schema('world_x') # Use the collection 'countryinfo' collection = schema.get_collection('countryinfo') # Specify which document to find with Collection.find() result = collection.find('_id like :param').bind('param', 'USA').execute() # Print document docs = result.fetch_all() print('id: {0}'.format(docs[0]['Name'])) 27
  • 28. Node.JS // Simple example to grab one record and print it const mysqlx = require('@mysql/xdevapi'); const options = { host: 'localhost', port: 33060, dbUser: 'dave', dbPassword: 'S3cR3t!!' }; mysqlx .getSession(options) .then (session => { var schema = session.getSchema('world_x'); //equivalent of SELECT doc FROM countryinfo where _id = 'USA' var coll = schema.getCollection('countryinfo'); var query = "$._id == 'USA'"; // Print doc return Promise.all([ coll.find(query).execute(function (doc) { console.log(doc); }), session.close() ]); }) .catch(err => { console.log(err.message); console.log(err.stack); }); 28
  • 29. PHP #!/usr/bin/php <?PHP // Connection parameters $user = 'dave'; $passwd = 'S3cR3t!'; $host = 'localhost'; $port = '33060'; $connection_uri = 'mysqlx://'.$user.':'.$passwd.'@'. $host.':'.$port; echo $connection_uri . "n"; // Connect as a Node Session $nodeSession = mysql_xdevapigetNodeSession($connection_uri); // "USE world_x" $schema = $nodeSession->getSchema("world_x"); // Specify collection to use $collection = $schema->getCollection("countryinfo"); // Query the Document Store $result = $collection->find('_id = "USA"')->fields(['Name as Country','geography as Geo','geography.Region'])- >execute(); // Fetch/Display data $data = $result->fetchAll(); var_dump($data); ?> 29
  • 30. How Does it Work?Very well, thank you! 30
  • 31. What does a collection look like on the server? mysql> DESC countryinfo; +-------+-------------+------+-----+---------+------------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+------------------+ | doc | json | YES | | NULL | | | _id | varchar(32) | NO | PRI | NULL | STORED GENERATED | +-------+-------------+------+-----+---------+------------------+ 2 rows in set (0.02 sec) mysql> show create table countryinfoG *************************** 1. row *************************** Table: countryinfo Create Table: CREATE TABLE `countryinfo` ( `doc` json DEFAULT NULL, `_id` varchar(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,'$._id))) STORED NOT NULL, PRIMARY KEY (`_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 1 row in set (0.00 sec) 31
  • 32. Every document has a unique identifier called the document ID, which can be thought of as the equivalent of a tables' primary key. The document ID value can be manually assigned when adding a document. If no value is assigned, a document ID is generated and assigned to the document automatically! Use getDocumentId() or getDocumentIds() to get _id(s) 32 _id
  • 33. You can also use the JavaScript or Python modes to process code // Connecting to MySQL and working with a Session var mysqlx = require('mysqlx'); // Connect to a dedicated MySQL server using a connection URL var mySession = mysqlx.getSession(‘acct:spE!@localhost'); // Get a list of all available schemas var schemaList = mySession.getSchemas(); print('Available schemas in this session:n'); // Loop over all available schemas and print their name for (index in schemaList) { print(schemaList[index].name + 'n'); } mySession.close(); 33
  • 34. But what about my existing relational tables?? 34
  • 35. Yes, the MySQL Document Store can work with relational tables too! # Working with Relational Tables import mysqlx # Connect to server using a connection URL mySession = mysqlx.get_session( { 'host': 'localhost', 'port': 33060, 'dbUser': ‘joe', 'dbPassword': ‘ZipL1p!'} ) myDb = mySession.get_schema('test') # Accessing an existing table myTable = myDb.get_table('my_table') # Insert SQL Table data myTable.insert(['name','birthday','age']) .values('Sakila', mysqlx.date_value(2000, 5, 27), 16).execute() # Find a row in the SQL Table myResult = myTable.select(['_id', 'name', 'birthday']) .where('name like :name AND age < :age') .bind('name', 'S%') .bind('age', 20).execute() # Print result print myResult.fetch_all() 35
  • 36. But what about relational tables and collections together? Eh, Dave? Huh, huh, huh? 36
  • 37. But what about relational tables and collections together? Eh, Dave? Huh, huh, huh? 37
  • 38. // Get the customers collection as a table var customers = db.getCollectionAsTable('customers'); customers.insert('doc').values('{"_id":"001", "name": "mike"}').execute(); 38 You can cast a collection as a table
  • 39. import com.mysql.cj.api.xdevapi.*; import com.mysql.cj.xdevapi.*; // Connect to server Session mySession = new SessionFactory().getSession("mysqlx://10.10.10.192:33060/test?user=betty12;password=Hush!"); Schema db = mySession.getSchema("test"); // Create a new collection Collection myColl = db.createCollection("my_collection"); // Start a transaction this.session.startTransaction(); try { myColl.add("{"name":"Jack", "age":15}", "{"name":"Susanne", "age":24}", "{"name":"Mike", "age":39}"); this.session.commit(); System.out.println("Data inserted successfully."); } catch (Exception err) { // Rollback the transaction in case of an error this.session.rollback(); // Printing the error message System.out.println("Data could not be inserted: " + err.getMessage()); } 39 Transactions!
  • 40. MySQL Document Store Available Now 40 ▪ Plug-in for - MySQL 5.7 - MySQL 8 ▪ Best of both SQL & NoSQL worlds ▪ Proven MySQL Technology
  • 41. Hello! Nice to meet you 41 Contact info: ▪ www.mysql.com ▪ David.Stokes@Oracle.com ▪ @Stoker ▪ Slides:slideshare.net/davidmstokes ▪ Blog: Elephantdolphin.blogspot.com ▪ Book in preperation now