1connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; 2connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; 3connection master; 4connection slave; 5SET GLOBAL time_zone='+0:00'; 6SET time_zone='+0:00'; 7CREATE TABLE t1 (a int, b char(10)); 8INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03'); 9SELECT * FROM t1; 10a b 11NULL NULL 120 test00 131 test01 142 test02 153 test03 16# 17# Testing errors 18# 19connection master; 20SET GLOBAL time_zone='+0:00'; 21SET time_zone='+0:00'; 22CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC 23CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=unknown&useSSL=false'; 24ERROR HY000: Connecting: java.sql.SQLException: Access denied for user 'unknown'@'localhost' (using password: NO) rc=-2 25CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC 26CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/unknown?user=root&useSSL=false'; 27ERROR HY000: Connecting: java.sql.SQLSyntaxErrorException: Unknown database 'unknown' rc=-2 28CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC TABNAME='unknown' 29 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false'; 30ERROR HY000: Cannot get columns from unknown 31SHOW CREATE TABLE t1; 32ERROR 42S02: Table 'test.t1' doesn't exist 33CREATE TABLE t1 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=JDBC 34CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false'; 35SHOW CREATE TABLE t1; 36Table Create Table 37t1 CREATE TABLE `t1` ( 38 `x` int(11) DEFAULT NULL, 39 `y` char(10) DEFAULT NULL 40) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false' `TABLE_TYPE`=JDBC 41SELECT * FROM t1; 42ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Unknown column 'x' in 'field list'' from CONNECT 43DROP TABLE t1; 44CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=JDBC 45CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false'; 46connection slave; 47ALTER TABLE t1 RENAME t1backup; 48connection master; 49SELECT * FROM t1; 50ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Table 'test.t1' doesn't exist' from CONNECT 51connection slave; 52ALTER TABLE t1backup RENAME t1; 53connection master; 54DROP TABLE t1; 55# 56# Testing SELECT, etc. 57# 58CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC 59CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false'; 60SHOW CREATE TABLE t1; 61Table Create Table 62t1 CREATE TABLE `t1` ( 63 `a` int(10) DEFAULT NULL, 64 `b` char(10) DEFAULT NULL 65) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false' `TABLE_TYPE`='JDBC' 66SELECT * FROM t1; 67a b 68NULL NULL 690 test00 701 test01 712 test02 723 test03 73DROP TABLE t1; 74CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=JDBC TABNAME='t1' 75 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false'; 76SHOW CREATE TABLE t1; 77Table Create Table 78t1 CREATE TABLE `t1` ( 79 `a` int(11) DEFAULT NULL, 80 `b` char(10) DEFAULT NULL 81) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false' `TABLE_TYPE`=JDBC `TABNAME`='t1' 82SELECT * FROM t1; 83a b 84NULL NULL 850 test00 861 test01 872 test02 883 test03 89DROP TABLE t1; 90CREATE TABLE t1 (a INT NOT NULL, b CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=JDBC 91CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false'; 92SHOW CREATE TABLE t1; 93Table Create Table 94t1 CREATE TABLE `t1` ( 95 `a` int(11) NOT NULL, 96 `b` char(10) NOT NULL 97) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false' `TABLE_TYPE`=JDBC 98SELECT * FROM t1; 99a b 1000 1010 test00 1021 test01 1032 test02 1043 test03 105DROP TABLE t1; 106CREATE TABLE t1 (a char(10), b int) ENGINE=CONNECT TABLE_TYPE=JDBC 107CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false'; 108SHOW CREATE TABLE t1; 109Table Create Table 110t1 CREATE TABLE `t1` ( 111 `a` char(10) DEFAULT NULL, 112 `b` int(11) DEFAULT NULL 113) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false' `TABLE_TYPE`=JDBC 114SELECT * FROM t1; 115a b 116NULL NULL 1170 0 1181 0 1192 0 1203 0 121DROP TABLE t1; 122connection slave; 123DROP TABLE t1; 124# 125# Testing numeric data types 126# 127CREATE TABLE t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float, g double, h decimal(20,5)); 128SHOW CREATE TABLE t1; 129Table Create Table 130t1 CREATE TABLE `t1` ( 131 `a` tinyint(4) DEFAULT NULL, 132 `b` smallint(6) DEFAULT NULL, 133 `c` mediumint(9) DEFAULT NULL, 134 `d` int(11) DEFAULT NULL, 135 `e` bigint(20) DEFAULT NULL, 136 `f` float DEFAULT NULL, 137 `g` double DEFAULT NULL, 138 `h` decimal(20,5) DEFAULT NULL 139) ENGINE=MyISAM DEFAULT CHARSET=latin1 140INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265); 141connection master; 142CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC 143CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false'; 144SHOW CREATE TABLE t1; 145Table Create Table 146t1 CREATE TABLE `t1` ( 147 `a` tinyint(3) DEFAULT NULL, 148 `b` smallint(5) DEFAULT NULL, 149 `c` int(7) DEFAULT NULL, 150 `d` int(10) DEFAULT NULL, 151 `e` bigint(19) DEFAULT NULL, 152 `f` double(14,0) DEFAULT NULL, 153 `g` double(24,0) DEFAULT NULL, 154 `h` decimal(27,5) DEFAULT NULL 155) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false' `TABLE_TYPE`='JDBC' 156SELECT * FROM t1; 157a b c d e f g h 158100 3333 41235 1234567890 235000000000 3 3 3141.59265 159DROP TABLE t1; 160connection slave; 161DROP TABLE t1; 162# 163# Testing character data types 164# 165CREATE TABLE t1 (a char(12), b varchar(12)); 166SHOW CREATE TABLE t1; 167Table Create Table 168t1 CREATE TABLE `t1` ( 169 `a` char(12) DEFAULT NULL, 170 `b` varchar(12) DEFAULT NULL 171) ENGINE=MyISAM DEFAULT CHARSET=latin1 172INSERT INTO t1 VALUES('Welcome','Hello, World'); 173SELECT * FROM t1; 174a b 175Welcome Hello, World 176connection master; 177CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC 178CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false'; 179SHOW CREATE TABLE t1; 180Table Create Table 181t1 CREATE TABLE `t1` ( 182 `a` char(12) DEFAULT NULL, 183 `b` varchar(12) DEFAULT NULL 184) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false' `TABLE_TYPE`='JDBC' 185SELECT * FROM t1; 186a b 187Welcome Hello, World 188DROP TABLE t1; 189connection slave; 190DROP TABLE t1; 191# 192# Testing temporal data types 193# 194CREATE TABLE t1 (a date, b datetime, c time, d timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, e year); 195SHOW CREATE TABLE t1; 196Table Create Table 197t1 CREATE TABLE `t1` ( 198 `a` date DEFAULT NULL, 199 `b` datetime DEFAULT NULL, 200 `c` time DEFAULT NULL, 201 `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), 202 `e` year(4) DEFAULT NULL 203) ENGINE=MyISAM DEFAULT CHARSET=latin1 204INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); 205Warnings: 206Note 1265 Data truncated for column 'a' at row 1 207Note 1265 Data truncated for column 'c' at row 1 208Warning 1265 Data truncated for column 'e' at row 1 209SELECT * FROM t1; 210a b c d e 2112003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 212connection master; 213CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC 214CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false'; 215SHOW CREATE TABLE t1; 216Table Create Table 217t1 CREATE TABLE `t1` ( 218 `a` date DEFAULT NULL, 219 `b` datetime DEFAULT NULL, 220 `c` time DEFAULT NULL, 221 `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), 222 `e` year(4) DEFAULT NULL 223) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root&useSSL=false' `TABLE_TYPE`='JDBC' 224SELECT * FROM t1; 225a b c d e 2262003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 227DROP TABLE t1; 228connection slave; 229DROP TABLE t1; 230SET GLOBAL time_zone=SYSTEM; 231SET time_zone=SYSTEM; 232connection master; 233SET GLOBAL time_zone=SYSTEM; 234SET time_zone=SYSTEM; 235