Reactive Relational Database Driver MySQL Implementation
This project contains the MySQL client protocol implementation of the JDBD SPI.
This implementation is not intended to be used directly, but rather to be used as the backing implementation for
a humane client library to delegate to.
How to run jdbd-mysql test use cases ?
CREATE DATABASE army_test DEFAULT CHARACTER SET utf8mb4 ;
CREATE USER army_w@’localhost’ IDENTIFIED BY ‘army123’ ;
GRANT ALL ON army_test.* TO army_w@’localhost’ ;
GRANT XA_RECOVER_ADMIN ON *.* TO army_w@’localhost’;
If meets MySQL 8.0.26 ,then INSTALL COMPONENT “file://component_query_attributes” ;
@see
io/jdbd/mysql/simple/HowToStartTests.java ,java class url
How to use native transport ?
maven
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>4.1.96.Final</version>
<classifier>osx-x86_64</classifier> <!-- here,just for mac os -->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-unix-common</artifactId>
<version>4.1.96.Final</version>
<classifier>osx-x86_64</classifier> <!-- here,just for mac os -->
</dependency>
</dependencies>
How to use unix domain socket ?
public class UnixDomainSocketTests {
@Test
public void unixDomainSocket() throws Exception {
// select @@Global.socket; // default is /tmp/mysql.sock
final String mysqlSocketPath = "/tmp/mysql.sock";
final String hostAddress = URLEncoder.encode(mysqlSocketPath, "utf-8");
// hostAddress result is /%2Ftmp%2Fmysql.sock
final String url = "jdbd:mysql://%2Ftmp%2Fmysql.sock/army_test";
final Map<String, Object> map = new HashMap<>();
map.put(Driver.USER, "army_w");
map.put(Driver.PASSWORD, "army123");
// properties will override the properties of url.
final DatabaseSessionFactory domainSocketSessionFactory;
domainSocketSessionFactory = Driver.findDriver(url).forDeveloper(url, map);
final ResultRow row;
row = Mono.from(domainSocketSessionFactory.localSession())
.flatMapMany(session -> Flux.from(session.executeQuery("SELECT current_timestamp AS now")))
.blockLast();
Assert.assertNotNull(row);
Assert.assertNotNull(row.get(0, LocalDateTime.class));
}
}
Reactive Relational Database Driver MySQL Implementation
This project contains the MySQL client protocol implementation of the JDBD SPI. This implementation is not intended to be used directly, but rather to be used as the backing implementation for a humane client library to delegate to.
How to run jdbd-mysql test use cases ?
the persistence frameworks that use jdbd-spi :
more jdbd-spi document see jdbd
How to start ?
Maven
Java code
@see io/jdbd/mysql/simple/HowToStartTests.java ,java class url
How to use native transport ?
maven
How to use unix domain socket ?
Properties config
@see io.jdbd.mysql.env.MySQLKey class
Core properties
more jdbd-spi document see jdbd